Google Chrome could not connect to localhost I am using OS X Mountain Lion 10.8.4.  I tried the steps in Installing Apache, PHP, and MySQL on Mac OS X to setup my dev environment, but I am not able to open the virtualhost I created – or localhost for that matter.

cURL gives me this error:


  curl: (7) couldn't connect to host


For those who are interested, here's my httpd-vhosts.conf file,

&lt;VirtualHost *:80&gt;
    DocumentRoot "/Library/WebServer/Documents"
&lt;/VirtualHost&gt;

&lt;VirtualHost *:80&gt;
    DocumentRoot "/Users/AnkurKaushal/Documents/workspace/dev"
    ServerName ankur.local
    ErrorLog "/private/var/log/apache2/ankur.local-error_log"
    CustomLog "/private/var/log/apache2/ankur.local-access_log" common

    &lt;Directory "/Users/AnkurKaushal/Documents/workspace/dev"&gt;
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow, deny
        Allow from all
    &lt;/Directory&gt;
&lt;/VirtualHost&gt;


and my /etc/hosts file:

127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0     localhost
127.0.0.1       ankur.local


What might I be missing here?
Just do sudo apachectl -t, that will help you fixing any issue your having with Apache configuration. 

In that case, it was just a simple space in httpd-vhosts.conf file that was causing the issue.