MacOS – I can not visit localhost with apache on OS X 10.9


The Chrome alert me

Oops! Google Chrome could not connect to localhost

But my apache still running:

  501 80299 71841   0  2:35PM ttys003    0:00.00 grep httpd

I paste some piece of important apache configuration , please help me. Thanks.


ServerRoot "/usr" Listen 80


DocumentRoot "/Users/username/Sites"

<Directory />   Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride None
    Order deny,allow
    Allow from all </Directory>

<Directory "/Library/WebServer/Documents">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all 

Actually I don't know what file I need to show you.

If you need more configuration file detail, please tell me. I will paste later.

Best Answer

Run this command:

sudo apachectl start

That should start your standard apache server software as well as edit the system startup files to cause it to start at boot. Replace start with stop to reverse that change. Your grep shows that httpd is not actually running and there's just the grep process active. You may need to look at the logs if after asking apachectl to start things up, the httpd process doesn't stay running (or even start in the first place).