Virtualhost responds locally but not from my machine
if i put an entry for it in my hosts file on the server, i can curl it on the server. If i do the same on my remote machine though i don't get any response.
Apache appears to be running the 2 sites fine:
VirtualHost configuration:
wildcard NameVirtualHosts and default servers:
*:80 is a NameVirtualHost
default server
port 80 namevhost
port 80 namevhost
Syntax OK
Its the shape-shift site i'm trying to get working. Devhaus is a proper domain but shape-shift-test is one i've made up.
Any ideas?
Thanks
10 Replies
Thanks
Both ping and curl work from the remote machine to the devhaus.co.uk domain.
Thanks
The way apache virtual hosts work is to look at the "host" header in the http request to work out which virtual host to route the request to. When you use a web browser to access virtual.site.com, your computer does a DNS lookup on virtual.site.com to find the IP address associated with that DNS record, and then sends the request to that IP address with the http host header set to "virtual.site.com", which lets the servers know that it should serve the site virtual.site.com, even if there are multiple sites on that IP address. If the host header isn't set, or if apache doesn't have a virtual site for that host, it serves the default site. In your case, this is
If I make a request to 176.58.108.244 (your IP address) and modify the host header to be "
I'm unsure as to why /etc/hosts isn't working as you want, however I have experienced /etc/hosts causing a lot of issues with apache, so maybe that'd explain it. It may also be useful to see a dump of your /etc/hosts file.
If you want to modify your headers yourself, so as to access the site remotely, you can use a tool such as
You can also do something similar with curl. I believe the usage is something along the lines of:
curl -H 'Host: www.shape-shift-test.co.uk' http://176.58.108.244/
Weird.
Thanks for you help everyone anyway
Give a shout if you have any further questions.
So odd.
I'd even checked the file perms and owner, and all were the same.
It remains a mystery