Note: Instead of doing everything below, you could just restore the backup of your httpd.conf that the Mavericks install created at
/etc/apache2/httpd.conf~previous. Wish I knew that 8 hours ago.
Because I like shiny new things, I decided to upgrade to Mavericks (OS X 10.9) last night. The upgrade finished around 1am, at which point I was tired, so I went to sleep. I woke up this morning to start my day, only to realize that all of my Apache Virtual Hosts were throwing 403: Forbidden errors. After a couple hours of chmod, chown, editing conf files and banging my head against the wall, I finally got it working. So if this happened to you, hopefully the following steps will help.
1. Your permissions are probably ok.
I loosened up all kinds of permissions in my www directory, but it turns out that that wasn’t the cause (at least I don’t think it was). Prior to the upgrade the apache service was running under _www:_www, and that hasn’t changed.
2. Edit the shit out of your httpd.conf.
I have my web root set to /var/www. It seems like the upgrade clobbered my httpd.conf and overwrote it with an out-of-the-box, dummified configuration. So my DocumentRoot was pointing to /Library/WebServer/Documents. Also, this dummified configuration had PHP disabled and some other stupid choices. Items in
code blocks are meant to be typed directly.
- Open Terminal.
sudo vi /etc/apache2/httpd.conf
/DocumentRoot: This will take you to the DocumentRoot section. Modify the path to point to your www directory (in my case, /var/www).
/This should be changed to whatever you set DocumentRoot to: This will take you to the <Directory> entry for your DocumentRoot. Change the path here to match what you changed it to above.
/php5_module: This will take you to the LoadModule line for PHP5. It’s commented out. <sarc>Thanks Apple!</sarc> Uncomment it (remove the # from the beginning of the line): Hit Esc
- Immediately following the last LoadModule line, add the following block:
<IfModule php5_module> AddType application/x-httpd-php .php <FilesMatch \.php$> SetHandler application/x-httpd-php </FilesMatch> AddType application/x-httpd-php-source .phps <IfModule dir_module> DirectoryIndex index.php index.html </IfModule> </IfModule>
/httpd-vhosts: This will take you to the line referencing your vhosts file. If you’re like me and you had a bunch set up, they will no longer be working because Apple, in their infinite wisdom, decided to comment this line out as well. Hit Esc
^xin order to uncomment this line.
- Hit Esc
:xto save and exit.
sudo apachectl restart
With any luck, everything should be working fine now. Let me know in the comments if I missed something. I made a lot of changes, but I’m pretty sure what I’ve documented above was what actually worked.
Update: Looks like Mavericks also broke Ant. Luckily I already had homebrew installed (though for some reason Ant isn’t in the main repo), so to fix this just type the following (assuming you already have homebrew installed):
brew install https://raw.github.com/Homebrew/homebrew-dupes/master/ant.rb