Starting apache on OS/X Mountain Lion

Apache is still bundled with Mountain Lion, but you can no longer start it using the "Sharing" icon under the "System Preferences" app.

To start it from the command line, just type:

sudo apachectl start

If you want to recreate the old behaviour where the "~/Sites" directory for a user can be accessed via http://127.0.0.1/~username/ create a file called "username.conf" under the directory /etc/apache2/users/ (replacing "username.conf" with your user's short name) before starting apache.

For example:

sudo vi /etc/apache2/users/brett.conf

Then add the following to the file:

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

Note that you can point this to any directory under your home directory. If you use ~/Sites for your http/php files, make sure you create the directory first:

mkdir ~/Sites

Now start apache:

sudo apachectl start

If you want to start apache, use:

sudo apachectl stop

If you want to start apache on every boot, use:

sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist