I have an ubuntu server running apache on localhost / port 80. It's domain is sub.domain.com
If I make a curl request to http://localhost on that machine it will error with 'couldnt connect to host' immediately.
If I make a curl request to sub.domain.com on that machine it will sit there in an infinite loop until it times out after a few minutes.
If I open sub.domain.com in my web browser on another machine it shows my html page.
If I make a curl request to sub.domain.com with another machine it will connect.
What's the deal here?
/etc/hosts
file look like on the server? Can you add it to the question. And check that/etc/nsswitch.conf
hashosts: files dns
somewhere (unless you know that it should be different).netstat -anp|grep :80|grep Listen
say? Does your apache only listen on specific IPs, but not on 0.0.0.0 or 127.0.0.1 specifically?