Setting up a local web server on Mac OS Sierra

For setting up a simple web server running on Mac OS Sierra, the easiest way is to use the default apache web server that is supplied with the OS. Its disabled by default, so start it with sudo privileges.

$ sudo apachectl start

Similarly, to stop the web server use

$ sudo apachectl stop

Apache configuration file is located at /etc/apache2/httpd.conf which you will need to edit in sudo mode.  Webroot directotry is  located at /Library/WebServer/Documents.
To enable php, uncomment LoadModule php5_module libexec/apache2/libphp5.so line in the Apache configuration file.

Advertisements