the horror!
The jist of starting and stoping apache:
$ sudo apachectl start
$ sudo apachectl stop
$ sudo apachectl restart
if you care about the HTTPD version
$ httpd -v
Server version: Apache/2.4.9 (Unix)
Server built: <Date>
http://localhost/ is stored at /Library/WebServer/Documents/
but I like to run my work from under my user directory, e.g., ~/Sites folder. Which requires some more configuration, see below:
Add <username>.conf
under /etc/apache2/users/
Add the following to <username>.conf
:
<Directory "/Users/<username>/Sites/">
AllowOverride All
Options Indexes MultiViews FollowSymLinks
Require all granted
</Directory>
The correct permission is 644 and root/wheel should be the owner/group.
$ sudo chmod 644 <username>.conf
Uncomment the following in /etc/apache2/httpd.conf
:
LoadModule authz_core_module libexec/apache2/mod_authz_core.so
LoadModule authz_host_module libexec/apache2/mod_authz_host.so
LoadModule userdir_module libexec/apache2/mod_userdir.so
Include /private/etc/apache2/extra/httpd-userdir.conf
Lastly, uncomment the following in /etc/apache2/extra/httpd-userdir.conf
:
Include /private/etc/apache2/users/*.conf
Ok, this works, but how to serve nodejs application to internet?