Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I installed a fresh TurnKey LAMP VM (Ubuntu, Apache2, PHP 5.2, the usual) in VirtualBox (latest). I configured networking so it has an IP of 192.168.1.111 on the bridged network. Then I logged into Webmin from the host machine at http://192.168.1.111/--worked fine. In Webmin I set up an Apache2 virtual host with the ServerName foo.local and set up a PHP app in the configured directory. Then I added the line 127.0.1.1 foo.local to /etc/hosts.

Now back in my host machine--Windows 7--I edited my C:/windows/system32/drivers/etc/hosts file and added the line 192.168.1.111 foo.local. Now, from Windows I can ssh jordan@foo.local just fine, and when I lynx http://foo.local/ from the VM it loads home page of the virtual host perfectly, and the app works perfectly.

But when I open a browser on the Windows host and navigate to http://foo.local/ I get unexpected results: In IE8 (not my browser of choice, for the record) when I hit http://foo.local/ it takes me to the VM's Webmin home page, i.e. the same thing as if I went to http://192.168.1.111/ on the host machine. In Chrome, however, I just get redirected to http://localhost/--i.e. Windows' localhost, which doesn't have a web server configured, so error.

Can anybody help me resolve this? I've tried every combination of configurations on both the host and in the VM that I can think of and it's driving me batty. Thanks in advance.

share|improve this question
add comment

3 Answers

Have you tried restarting chrome to ensure it has picked up the modified hosts file?

Another option is:

  • Go to the Wrench icon
  • Options
  • Under the Hood
  • Clear browsing data
  • Turn off all check boxes other than Empty the cache.
  • Click Clear browsing data
share|improve this answer
    
Thanks. I have done all of those things with no success. –  Jordan Sep 1 '10 at 4:16
add comment

Make sure you have NameVirtualHost *:80 in your Apache config file, I know CentOS/RHEL have it commented out by default.

share|improve this answer
add comment
up vote 0 down vote accepted

I somehow finally resolved this. Like I said, tried every configuration I could think of, but in the end it was changing <VirtualHost foo.local:80> in foo.local.conf to <VirtualHost *:80>.

I still don't know why Chrome is misbehaving--some sort of caching issue, probably--but it's working in at least one browser on the host machine, so I'm happy.

share|improve this answer
1  
Ah yes it should be <VirtualHost *:80> and then ServerName foo.local within the <VirtualHost> block. Sorry I assumed that was already that way :) –  Geraint Jones Sep 1 '10 at 4:36
1  
*:80 tells apache to do Name Based Vhosting - the other option is IP Based Vhosting and by having foo.local set to 127.0.0.1 in your servers hosts file that would have become <VirtualHost 127.0.0.1:80> which is an IP Based VHost. That is why it was working on the server but not over the network. –  Geraint Jones Sep 1 '10 at 4:39
    
Thanks for the clarification, c10k. Probably I should have posted the .conf file for good measure; I'm not sure if it was Webmin's mistake or my own, but it doesn't much matter anymore. –  Jordan Sep 1 '10 at 5:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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