0

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.

Jordan
  • 101
  • 4

3 Answers3

1

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
Dan McGrath
  • 380
  • 1
  • 11
1

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

Geraint Jones
  • 2,483
  • 16
  • 19
0

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.

Jordan
  • 101
  • 4
  • 1
    Ah yes it should be `` and then `ServerName foo.local` within the `` block. Sorry I assumed that was already that way :) – Geraint Jones Sep 01 '10 at 04: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 `` which is an IP Based VHost. That is why it was working on the server but not over the network. – Geraint Jones Sep 01 '10 at 04: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 01 '10 at 05:20