Mac OS Mountain Lion - Apache running but localhost not working [closed]
To verify that a process is listening on port 80, you can use lsof in a terminal window:
$ sudo lsof -iTCP:80 -sTCP:LISTENCOMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAMEhttpd 88 root 4u IPv6 0xffffff8018804600 0t0 TCP *:http (LISTEN)httpd 90 _www 4u IPv6 0xffffff8018804600 0t0 TCP *:http (LISTEN)httpd 14843 _www 4u IPv6 0xffffff8018804600 0t0 TCP *:http (LISTEN)
This will verify that you successfully enabled apache.
(I have xcode installed, but I think lsof is part of the normal install)
ADDED:
That confirms that apache is listening on port 80. The next step I would take is to look at the access logs, to see what apache logged when you requested '/' as shown in the error apache returned to your browser. This is what mine shows. Note that the http GET request is shown with the return code 200 (success):
bash-3.2# grep 'GET / ' /private/var/log/apache2/access_log 127.0.0.1 - - [12/Sep/2012:16:46:45 -0400] "GET / HTTP/1.1" 200 44127.0.0.1 - - [12/Sep/2012:16:49:44 -0400] "GET / HTTP/1.1" 200 44
You can also confirm what url your browser is requesting by refreshing your browser window, then confirming that apache logs that new request to the access_log.
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.
Comment out all of the IfDefine !WEBSERVICE_ON
tags, keeping the content within -- there is no WEBSERVICE
on Mountain Lion.