I loaded Apache Web server on Mac OS Mountain Lion with the command
sudo apachectl start
However, when I try to open localhost in Firefox, I get the message
Not Found: The requested URL / was not found on this server. Apache/2.2.21 (Unix) DAV/2 Server at localhost Port 80
I edited both httpd.conf and httpd.conf.default to change
#ServerName www.website.com
to
ServerName localhost
It still doesn’t work. Any suggestions?
You should check the permissions on the folder specified as the “DocumentRoot” in your “httpd.conf”, and allow at least read access for the Apache user (which should by “_www” by default).
Otherwise you could do a “sudo chmod 755” on the “DocumentRoot” folder.
By the way, you should only modify the “httpd.conf” file, since the “httpd.conf.default” is a default configuration that you can use if you want to restore the Apache original configuration, by simply overwriting the “httpd.conf” file with the “httpd.conf.default” file.
I suppose that you’ve not enabled name-based virtual hosts, since when you enable name-based virtual hosts, the document root in the main config is ignored; instead, the root for the matching hostname will be used, and if none match it will default to the first virtual host.
Finally, when you have problems, the first thing to check is always the Apache error log file.
The location of the the error log can be found by looking at the “ErrorLog” directive in the Apache configuration file.