Enabling Apache in Mac OS X Mountaion Lion
This is my first Mac, it's Mountain Lion, and I know how to enable Apache through Preferences -> Sharing -> Web Sharing, but how the hell do I do it in Mountain Lion?
I find that that button no longer exists, so what's the Ternimal command to turn it on manually?
To start apachesudo apachectl start
This will give you a basic Apache server with a DocumentRoot at /Library/WebServer/Documents/
You can enable things like PHP and virtualhosts by making use of the configuration file, which must be edited as root:/etc/apache2/httpd.conf
Restart the apache server (like after editing the config file) withsudo apachectl graceful
Stop the apache serversudo apachectl graceful-stop
I believe in order to use user directories (like allowing ~/Sites/
to be accessed at http://localhost/~username/
) or to get httpd to run at startup, you will need to do a little tweaking. I unfortunately can't test how easy it is to get the full functionality of the previous versions back since my Apache configs did not come from a "clean" 10.8 install.
To make it permanent you can do this:
sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
the '-w' option sets it to restart the service on rebooting etc.