Apache on OSX 10.8 Mountain Lion

$ sudo httpd restart

I upgraded to Mountain Lion (10.8.x) from Lion (10.7.x) a few months ago, and only discovered today that Apache wasn’t working–going to http://localhost showed the default “It works!” page.

A quick search for “apache mountain lion” found this helpful guide: AMP Guide for Mac OSX 10.8.

tl;dr; for those who know what they are doing:

  • There is no longer a Web Sharing section in System Preferences > Sharing.
  • Use sudo httpd start|stop|restart to control the Apache process
  • Main configuration file: /etc/apache2/httpd.conf
  • Default DocumentRoot is /Library/WebServer/Documents
  • Enable PHP by uncommenting the PHP module include in httpd.conf
  • User configuration file: create one at etc/apache2/users/YOURUSERNAME.conf

Sample user conf contents:

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

blog comments powered by Disqus


07 November 2012


Make a Donation