macOS Apache¶
/Library/WebServer/Documents
/Users/username/Sites
Enabling the Web Server¶
Command to Enable the Web Server¶
In Mountain Lion, the Web Sharing checkbox in System Preferences > Sharing is gone. Instead, do the following:
sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
sudo apachectl start
also enables the launchd
daemon.
It overrides the Disabled key in /System/Library/LaunchDaemons/org.apache.httpd.plist
by modifying /private/var/db/launchd.db/com.apple.launchd/overrides.plist
, just like launchctl load -w
.
Note¶
For http://localhost/~username/ to work, you have to create /etc/apache2/users/username.conf
and add a <Directory>
directive like this:
<Directory "/Users/username/Sites/">
Options Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
or add in FollowSymLinks
to avoid having issues when hosting WordPress sites in the folder:
<Directory "/Users/username/Sites/">
Options FollowSymLinks Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Apache Web Server - Keep the Webserver on on After Restart¶
sudo defaults write /System/Library/LaunchDaemons/org.apache.httpd Disabled -bool false
http://reviews.cnet.com/8301-13727_7-57481978-263/how-to-enable-web-sharing-in-os-x-mountain-lion/
Adding Virtual Hosts¶
sudo vim /etc/apache2/extra/httpd-vhosts.conf
Useful Links¶
Tuts¶
- https://discussions.apple.com/docs/DOC-3083
- http://superuser.com/questions/455505/how-do-i-start-apache-in-osx-mountain-lion
- http://www.cultofmac.com/242258/enable-the-web-server-in-mountain-lion-os-x-tips/
- http://computers.tutsplus.com/tutorials/3-ways-to-bring-back-web-sharing-in-os-x-mountain-lion--mac-45240
Apps¶
- http://clickontyler.com/blog/2012/02/web-sharing-mountain-lion/
- [paid product] http://hammerformac.com/
Other Links¶
- http://apple.stackexchange.com/questions/80203/starting-apache2-on-mountain-lion
- http://www.coolestguidesontheplanet.com/downtown/install-and-configure-apache-mysql-php-and-phpmyadmin-osx-108-mountain-lion
- http://damianoferrari.com/set-up-apache-and-php-on-os-x-10-8-mountain-lion/
- http://stackoverflow.com/questions/8065288/how-to-remove-autostart-of-apache-on-macosx