Web server in OSX (Apache2, dammit!)

There’s an Apache2 in OSX!!!

Apache2! It’s been awhile since I touched httpd.conf… so many memories… ūüėČ

It’s all described in this tutorial:¬†http://osxdaily.com/2012/09/02/start-apache-web-server-mac-os-x/

It’s dead simple – see/edit¬†/etc/apache2/httpd.conf to find or set DirectoryRoot (mind directory access rights) and run “sudo apachectl start” (stop, restart).

To enable user websites, add following to etc/apache2/users/USERNAME.conf :

<Directory "/Users/USERNAME/Sites/">
Options Indexes Multiviews
AllowOverride AuthConfig Limit
Order allow,deny
Allow from all
</Directory>

and then it’d be served as¬†http://127.0.0.1/~USERNAME/

Also, generating self-signed certificates: https://devcenter.heroku.com/articles/ssl-certificate-self

And adding them to OSX keychain: https://tosbourn.com/getting-os-x-to-trust-self-signed-ssl-certificates/

And you’d need to put them into¬†/private/etc/apache2/ssl/ and (potentially) edit¬†/private/etc/apache2/extra/httpd-ssl.conf and enable (uncomment)

Include /private/etc/apache2/extra/httpd-ssl.conf

and

LoadModule ssl_module libexec/apache2/mod_ssl.so

in /etc/apache2/httpd.conf

and run “apachectl restart” as root.

Champagne for all!

  _
 {_}
 |(|
 |=|
/   \
|.--|
||  |
||  |    .    ' .
|'--|  '     \~~~/
'-=-' \~~~/   \_/
       \_/     Y
        Y     _|_
       _|_

Leave a Reply

Your email address will not be published. Required fields are marked *