Enable Apache on Mountain Lion

Mac OS X Mountain Lion comes with Apache installed but not enabled. Here are the steps to re-enable Apache

1. Open the OS X Terminal (/Applications/Utilities/)

2. Create and open an Apache user configuration file named for your account in your favorite editor. I am using TextMate so I used the following command

sudo mate /etc/apache2/users/[username].conf

3. Copy the following text into the file that opens, but be sure to change the [username] text to the short name of your user account:

<Directory “/Users/[username]/Sites/”>
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

4. Save the file and close the editor.

5. Enable apache by typing

sudo apachectl start

6. Verify Apache is up by typing the following url into your browse

http://localhost/~%5Busername%5D

7. To enable the server even after subsequent reboots

sudo defaults write /System/Library/LaunchDaemons/org.apache.httpd Disabled -bool false

8. To disable the server even after subsequent reboots

sudo defaults write /System/Library/LaunchDaemons/org.apache.httpd Disabled -bool true

9. To be sure the files (and any others you may have configured) are properly accessible

sudo chown root:wheel /etc/apache2/users/*
sudo chmod 644 /etc/apache2/users/*
sudo apachectl restart

Dwain

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s