Since macOS Sierra 10.x apache has been built-in. Run these command to start / restart / stop apache
sudo /usr/sbin/apachectl start
sudo /usr/sbin/apachectl stop
sudo /usr/sbin/apachectl restart
sudo /usr/sbin/apachectl status
cd /usr/local/var/www
cd /etc/apache2
sudo nano /etc/apache2/httpd.conf
Open apache config file
sudo nano `/etc/apache2/httpd.conf`
Find and uncomment httpd-vhosts
line
Include /private/etc/apache2/extra/httpd-vhosts.conf
Now add your virtual host configuration into httpd-vhosts.conf
file:
<VirtualHost *:80>
ServerAdmin admin@localhost
ServerName my-domain.local
DocumentRoot "/Library/WebServer/Documents"
</VirtualHost>
Edit /etc/hosts
to add virtual host domain
sudo nano /etc/hosts
# add this domain to hosts file
127.0.0.1 my-domain.local
Restart apache
sudo /usr/sbin/apachectl restart