403 Forbidden Error when trying to view localhost on Apache
- by misbehavens
I think my Apache must be all screwed up. I don't know if it ever worked. I just upgraded to Snow Leopard, and the first step on this tutorial is to start apache and check that it's working by opening http://localhost. It starts fine but when I go to localhost I get a 403 forbidden error.
I don't know where to start figuring out how to fix it, so I wonder if a fresh install of Apache would do the trick.
What do you think?
Update: I found some error logs in /private/var/log/apache2/. Found this in one of the logs. Not sure what it means:
[Tue Nov 10 17:53:08 2009] [notice] caught SIGTERM, shutting down
[Tue Nov 10 21:49:17 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
Warning: DocumentRoot [/usr/docs/dummy-host.example.com] does not exist
Warning: DocumentRoot [/usr/docs/dummy-host2.example.com] does not exist
httpd: Could not reliably determine the server's fully qualified domain name, using Andrews-Mac-Pro.local for ServerName
mod_bonjour: Skipping user 'andrew' - cannot read index file '/Users/andrew/Sites/index.html'.
[Tue Nov 10 21:49:19 2009] [notice] Digest: generating secret for digest authentication ...
[Tue Nov 10 21:49:19 2009] [notice] Digest: done
[Tue Nov 10 21:49:19 2009] [notice] Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8k DAV/2 PHP/5.3.0 configured -- resuming normal operations
Update: I also found something in the dummy-host.example.com-error_log file. I didn't set these dummy-host things by the way. Is this the default configuration?
[Tue Nov 10 21:59:57 2009] [error] [client ::1] client denied by server configuration: /usr/docs
Update: Woohoo! I found the file that had the virtual host definitions. It was in /etc/apache2/extra/httpd-vhosts.conf. It had those two dummy virtual host settings in there. I added a localhost virtual host. Not sure if this is necessary, but since it wasn't working before, decided to do it anyway. After removing the old virtual hosts, adding my new localhost virtual host, and restarting apache, it seems to work. So I guess whenever I want to add a virtual host, I only need to add them to this file? Or is there a hosts file somewhere, like there is on Linux?
Update: Yes, there is an /etc/hosts file that need to be changed to. Add the virtual host name to that file.