Mountain Lion and Apache

With OS X 10.8 (Mountain Lion), the setup process for getting Apache and PHP (now version 5.3.13) working is simpler. Gone are the tangled IfDefine statements in httpd.conf now all you need to do is drop an appropriate file into /etc/apache2/users. If you don’t need SSL support, it’s almost trivial:

NameVirtualHost *:80

<Directory "/Users/YOURLOGIN/Sites/">
    Options Indexes MultiViews FollowSymLinks Includes
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

<VirtualHost *:80>
    ServerName local.dev
    ServerAlias *.dev
    UseCanonicalName off
    VirtualDocumentRoot /Users/YOURLOGIN/Sites/%-2.0.dev/
</VirtualHost>

If you do need SSL, you’ll also need to add a few extra directives before you put in a VirtualHost *:443 block (since the default OS X apache config doesn’t have SSL support enabled, and the SSL config file includes a default SSL VirtualHost):

Listen 443
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl    .crl
SSLPassPhraseDialog  builtin
SSLSessionCache        "shmcb:/private/var/run/ssl_scache(512000)"
SSLSessionCacheTimeout  300
SSLMutex  "file:/private/var/run/ssl_mutex"

and follow the directions in the previous post to set up an SSL certificate.

Other than that, the Apache-PHP-MySQL setup is the same as described previously.