Apache VirtualHost on Mac OSX

note to self:

to set up a virtual host named viho for local web development testing on OSX El Capitan (and probably earlier):

  1. define an alias name in /etc/hosts:
    127.0.0.1       localhost viho
    ::1             localhost viho
    
  2. setup the virtual host configuration file /etc/apache2/other/viho.conf:
    <VirtualHost *:80>
      DocumentRoot "/path/to/where/the/files/are"
      ServerName viho
    </VirtualHost>

browse to http://viho/ and enjoy.

Apache on Mac OSX El Capitan

Note to self:

To start or stop the Apache webserver on Mac OSX El Capitan, use the terminal:

sudo apachectl start

sudo apachectl stop

sudo apachectl restart

The configuration is found in /etc/apache2/httpd.conf. The default DocumentRoot directory isĀ /Library/WebServer/Documents. Additional configuration files should be put in _/etc/apache2/other/*.conf_ files.