Page 1 - Brew, Apache, Mysql, phpMyAdmin
Page 2 - Exim, Dovecot, Spamassassin, Clamav, Roundcube
Page 3 - PowerDNS Recursor and Authoritative Server
Page 4 - Nginx (optional)
Page 5 - PureFTPd and Webalizer (optional)
Page 6 - SSL Certificates using Let'sEncrypt
Page 7 - Upgrading to Catalina 10.15
Upgrades - How to upgrade brew modules

Few things before you start installing the below listed items on Mojave.

1. SIP needs to be disabled.

2. On unsupported macs like 2008 and 2009 2,1 and 3,1 models you need to use a patcher from dosdue1 in order to be able to install/boot into Mojave. Your best bet is if you use an SSD that is formatted APFS. Anything else will not give you the performance/speed (on these older macs) that is satisfactory. (Although you can install on a drive as well.)

3. An excellent free code/text editor (Visual Studio Code) with a built in terminal is available for download. It will allow you to edit various config files with admin privilege from user desktop.

  Apple Command Line tools

Install command line tools via terminal and allow third party software installation:

$ xcode-select --install
$ sudo spctl --master-disable

  Basic Brew Installation

$ ruby -e "$(curl -fsSL"

  Apache • PHP • MySql • phpMyAdmin

Install the following brew modules

$ brew install openssl httpd php mysql phpmyadmin
$ echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile (restart terminal)
$ openssl version

Download and install:
pkg server_setup.pkg - includes various edited config files and startup file for mysql.

Modify mysql to run under user  "_mysql"  in the background even when you're logged out from your desktop.

$ sudo -s
$ chown -R _mysql:_mysql /usr/local/var/mysql
$ brew services start httpd; brew services start php
$ launchctl load /Library/LaunchDaemons/net.captainnet.mysql.plist
$ exit

Setup MySql and create a root password. Follow instructions for secure installation.

$ mysql_secure_installation

  Setup Mailadmin (ECM3)

Download and install MailAdmin:
pkg ecm3.pkg | Updated Aug28, 2019 - Some bug fixes. Replace previously installed version.

Create database for ecm3 (login with the above created root password.

mysql -h -u root -pPASSWORD
CREATE database ecm3; use ecm3; \. /usr/local/share/mailadmin/sql/ecm3.sql

For mailadmin (ecm3) enter your mysql root password.

$ open -e /usr/local/share/mailadmin/config/variables.php

$sqlpass = "password"; // Database password


Initial username for mailadmin is 'siteadmin' with password 'change'.

  Virtual Hosts

If you're ready for virtual host setup uncomment the following line in your httpd config file.

$ open -e /usr/local/etc/httpd/httpd.conf

Include /usr/local/etc/httpd/sites/*.conf

You will also have to edit the domain config with your domain name and IP address. (/usr/local/etc/httpd/sites/
Nameservers pointing to your domain will also have to be set. Stop and start apache or reboot your computer and test the following links:

$ sudo apachectl -k stop
$ sudo apachectl -k start