As a webdeveloper I have an Apache server running on my local machine which I use for developing. The server is listening on every IP address on port 80 as per default. However I've used the httpd.conf to control who can access the server and that's basically me and everyone else on the LAN, no outside access is permitted.

I also have some virtual-hosts configured. Something like this goes on httpd-vhosts.conf file:

NameVirtualHost localhost:80

<VirtualHost localhost:80>
  DocumentRoot "C:\Users\Nazgulled\Workspace\Htdocs\Project1"
  ServerName project1.domain.com

On my local machine I access this project website by navigating to project1.domain.com (the same address is pointing to in the hosts file).

On the VMware guest I can easily point to the host's IP address (using NAT as it works better/faster for me) and access the root of the web server, but I can't manage to access the project website navigating to project1.domain.com. I tried to point that address to the hosts's IP address in the hosts file (just like I did in the local machine but with a different address) but it didn't work.

The one thing I tried was to replace localhost:80 by *:80 but it didn't seem to have any effect.

I have no other ideas how can I make this work, suggestions?

  • Can you resolve project1.domain.com and ping it? – faker Oct 8 '10 at 1:02
  • Since I added an entry to the guest's hosts file, it resolves to that address; the host's IP. – rfgamaral Oct 8 '10 at 1:10

You are right, you need to change localhost:80 to *:80.
Add ErrorLog and CustomLog to that VirtualHost and check if it provides any useful information.

To debug try:

curl -H "Host:project1.domain.com" IP-of-your-server

This should give you at least an error message from Apache.
If curl times out then you probably have a general network issue.

  • I don't have curl on the guest machines... They basically have Windows and browser installed (most of the browser actually) and nothing else. – rfgamaral Oct 8 '10 at 7:50
  • OMG! I was testing it wrong... I was actually looking at the right page, it was working all the time (well, almost). I just thought I was supposed to see something else. I had to change localhost:80 to *:80 anyway. – rfgamaral Oct 8 '10 at 11:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.