3
I'm using Mac OS X 10.8.2 and I have in my local /etc/hosts this content:
127.0.0.1 dev.test.local
Together with that I locally got nginx installed to serve static files for that domain. And while it works it takes ~5 seconds before nginx gets the connection. Demonstrated by:
ba@djuproera% time curl -I http://dev.test.local/
curl: (7) couldn't connect to host
curl -I http://dev.test.local/ 0.00s user 0.00s system 0% cpu 5.010 total
What I noticed was that if I change my hosts file to this:
127.0.0.1 dev.test.com dev.test.local
I get normal sub-second responses:
ba@djuproera[master*](ruby-1.9.3)% time curl -I http://dev.test.local/
curl: (7) couldn't connect to host
curl -I http://dev.test.local/ 0.00s user 0.00s system 2% cpu 0.285 total
Extra interesting is that if I switch the order of the domains in the hosts file I get slow responses again:
127.0.0.1 dev.test.local dev.test.com
Gives:
ba@djuproera[master*](ruby-1.9.3)% time curl -I http://dev.test.local/
curl: (7) couldn't connect to host
curl -I http://dev.test.local/ 0.01s user 0.00s system 0% cpu 5.011 total
Do anyone have any idea what's going on here?
And while curl is saying it can't connect that's just because I had disabled nginx to see if the problem was nginx or something else, as it turned out it was something else… – gaqzi – 2013-01-22T16:42:15.213