(I've read many StackOverflow articles that address vhosts in MAMP, but none of them solved this.)
I'm trying to set up a virtual host on my MacBook. I'm using the exact same virtual host setup as I am on my Windows machine, which works fine.
First I edited the hosts file. Under the 127.0.0.1 localhost line I added:
127.0.0.1 dev.mysite.com
Next I edited /Applications/MAMP/conf/apache/httpd.conf and removed the # from the vhosts include:
# Virtual hosts
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
Next I edited /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "/Users/Gavin/Web"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/Users/Gavin/Web/mysite/public_html"
ServerName dev.mysite.com
</VirtualHost>
Next I opened Terminal and ran dscacheutil -flushcache and restarted MAMP. localhost works fine, dev.mysite.com gives the standard Chrome This webpage is not available error.
httpd -Sit says my virtual host syntax is OK. - Gavinhost dev.mysite.com), then only the gap between is left. So start digging there then: take a network sniffer or a debugging proxy and check the traffic sent (if any). There must be some trace somewhere. - arkascha