The Easy Guide shows you Step-by-Step How to Set-Up an IP Based Virtual Hosts Loopback for Apache Web Server on macOS Desktop.
The Contents and Details are Essentials and Give Focus only to Instructions and Commands.

Open Terminal Window
(Press “Enter” to Execute Commands)Make a Loopback Alias
sudo su
If Got “User is Not in Sudoers file” then see: How to Enable sudo
Example:ifconfig lo0 alias 127.0.0.2
Inserts New IP on /etc/hosts
nano /etc/hosts
Modify Line Containing localhost for Example Like:
127.0.0.1, 127.0.0.2 localhost
Ctrl+x to Save & Exit :)
Enabling Virtual Host
- Enable Virtual-Host Conf File
nano /conf/httpd.conf
Check that the Line Below Is Not Commented Out…
Include /extra/httpd-vhosts.conf
(By Default apache2 Dir is Inside /private/etc/)
- Make the New Host Directory
mkdir /Library/WebServer/Documents2
echo 'Working!' > /Library/WebServer/Documents2/index.html
- Set-Up IP Based Virtual-Hosts
nano /extra/httpd-vhosts.conf
Inserts Something Like:
ServerAdmin admin1@example.com
DocumentRoot “/Library/WebServer/Documents”
ServerName localhost.1
ErrorLog “/private/var/log/apache2/localhost1.com-error_log”
ServerAdmin admin2@example.com
DocumentRoot “/Library/WebServer/Documents2”
ServerName localhost.2
ErrorLog “/private/var/log/apache2/localhost2.com-error_log”
- Give Permissions to New Host Root Directory
nano /conf/httpd.conf
Inserts Below the Existing Root Directory:
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
- Enable Virtual-Host Conf File
Restart Apache
Next Access New Virtual Host on Browser
It Should Be Just Successfully Working! :)
How to Install Apache Cassandra NoSQL Database for macOS: