MacOS – Starting Apache2 on Mountain Lion

apacheconfigurationmacosweb-sharingwebserver

I have tried every option to get apache2 to work in Mountain Lion, and I am baffled by how impossible the task seems to be.

I just got a new iMac and on a fresh, clean install, I went about setting up apache to serve local sites.

Using the usual suspects of possible configuration changes, I can get apache to actually "start" but then things go downhill from there.

No matter how I define the local server root, I always get a Forbidden error. I can chmod the directory structure to 777 and I still get a Forbidden error.

I have set the server root as the default /Library/WebServer/Documents/, set it to /Users/myUserName/Sites/, /Users/myUserName/Documents/Sites, /Volumes/ExternalDrive/Site/ and any other possible combination, modifying /etc/apache2/httpd.conf and/or /private/etc/apache2/httpd.conf as well as the vhosts file and the myUserName.conf file. Nothing makes a difference.

I have restarted apache with sudo apachectl restart as well as sudo apachectl stop followed by sudo apachectl start.

Nothing works.

Can someone help me get this issue resolved? I am beginning to want to throw my brand new iMac against the wall.

Note, I am not a novice at this and I have set up dozens of Macs. However, nothing seems to work this time. I even reformatted and reinstalled the system again.

Best Answer

Run this command to see if you have errors in your configuration: sudo apachectl -t

You can find more info here.