Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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.

share|improve this question
1  
Did you enable DirectoryListings in Apache? Do you have an index.html file in your WebRoot? –  Purple Tentacle Jan 28 '13 at 9:14
    
When you say "I went about setting up apache to serve local sites." what have you done? Did you check that Apache worked on the brand new OS install before you did anything? What errors do you get in the Apache log? –  Tony Williams Jan 28 '13 at 9:47
    
Is there a reason you are jumping through Unix CLI hoops to start the service when on Macs all one really needs to do is go to System Preferences then choose Sharing and then start Web Sharing? –  JakeGould Jan 28 '13 at 14:57
    
@JakeGould The web sharing checkbox was removed in 10.8. –  Lri Jan 29 '13 at 5:54
1  
@JakeGould As Lauri said, Web Sharing was removed in 10.8. But further to that, I want to install custom compiled PHP, updated MySQL, latest phpMyAdmin, and a host of other enhancements. So, before I get those installed, I need to ensure that apache is running...and it won't. –  alisamii Jan 29 '13 at 9:39

4 Answers 4

up vote 1 down vote accepted

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

You can find more info here.

share|improve this answer
1  
I'm surprised no one else went down the configtest path and it might catch a permission error... –  bmike Aug 23 '13 at 15:14
    
I actually solved this issue by doing what you suggest...months ago. I should have answered my question myself when I resolved the issue. However, glad that you answered it. I can now accept this as it did reveal some problems which I was able to resolve (although I no longer remember what the problems were). –  alisamii Aug 24 '13 at 10:19

Try MAMP or even MAMP Pro, both have software that you can start/stop your apache and mysql.

http://www.mamp.info/en/index.html

MAMP Pro also supports virtual hosts

share|improve this answer
    
The problem with MAMP and MAMP Pro is that they are slow to update the components. Of course, I could go ahead and update them myself, but then, why install a software emulating a software and update the emulating software when it is available natively on the system. –  alisamii Jan 31 '13 at 16:58

sudo apachectl start starts Apache and enables /System/Library/LaunchDaemons/org.apache.httpd.plist.

To make http://localhost/~username/ work, save something like this as /etc/apache2/users/username.conf:

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

I didn't have to edit any other files or httpd.conf.

share|improve this answer

If you're really struggling, you might give VirtualHostX a try… it's a Mac app that helps you configure apache to run multiple websites from a single Mac, but it works just as well with a single website. It's a paid app, but it has a 30-day trial period.

share|improve this answer
    
Not the type of solution I am looking for. I could easily try a BitNami stack for Mac OS as well, or MAMP Pro, but none of these are the same as a standard clean, self-managed AMP stack. –  alisamii Jan 29 '13 at 9:41
    
If a standard, clean, self-managed *AMP stack is a goal, I strongly recommend Ubuntu on VirtualBox. 100% pure LAMP stack & no wasted time (sometimes days) dealing with Mac AMP stack silliness. –  JakeGould Jan 29 '13 at 12:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.