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 have a Ubuntu 12.04 system running VirtualBox. I installed Windows XP as a VM and it is working perfectly. I configured file sharing which works fine. I can also type the IP of my host machine into Internet Explorer on the VM and Apache on my host machine serves up a response with the default "It Works" default page.

By default when I type my IP address into the browser like: http://10.10.10.10, the host Apache server will use /var/www for serving requests. If I type: http://10.10.10.10/dev it will get /var/www/dev which is what I would expect it to do.

Now for the tricky part that I can't find a solution. What I'm trying to be able to do is instead of typing: http://10.10.10.10/dev/mysite/httpdocs/ I can just type http://mysite.dev and it will route just like a vhost. I currently have a vhost setup like that in my Ubuntu host machine and it works fine from a browser in the host, but not in the guest OS (Windows XP). If I type the vhost URL in the VM/Guest browser, it will just return the default at /var/www/.

[Added Info] I need this functionality so I can test web applications in IE. The applications typically use relative links for resources and URL rewriting which won't resolve correctly with a full file path, and instead need a domain name root. Any help would be appreciated.

[Requested Files]

HOST OS (Ubuntu 12.04)

GUEST OS (Windows XP)

share|improve this question
    
Have you set NameVirtualHost *:80 before declaring the virtual hosts? Could you please show us the (relevant) parts of your httpd.conf file? Wait, are you trying to query the Apache server installed on your host from the guest OS (windows XP)? What have you added in the Windows XP hosts file? –  Mihai Todor Jul 30 '12 at 15:03
    
Yes, I am trying to query Apache located on host from inside guest OS. Works fine for 10.10.10.10/dev/mysite/somescript.php (not my real IP) but wont access the virtualhosts I have setup in apache. Host OS (Ubuntu) can access the vhosts fine. –  cillosis Jul 30 '12 at 15:23
    
OK, got it. In this case, can you please post the contents of the Windows hosts file and httpd.conf (maybe also httpd-vhosts.conf if you changed it)? Also, the /var/www/dev/.htaccess file can be relevant. –  Mihai Todor Jul 30 '12 at 16:42
    
@MihaiTodor Thanks for your help so far, I've added relevant files above. –  cillosis Jul 30 '12 at 18:23
    
Maybe I'm not understanding your setup properly, but shouldn't the Windows XP hosts file contain this line: 10.10.10.10 mysite.dev? Otherwise, how would it know where to forward the request? Still it's strange because I would expect the Windows guest to not be able to resolve http://mysite.dev at all instead of redirecting it to http://mysite.dev/var/www/. Hmmmmmmmmmmmm... Maybe the DNS request is being resolved by the Ubuntu host somehow. I don't have a Linux machine to test such a setup right now, but let me know if this fixes it. –  Mihai Todor Jul 30 '12 at 19:21

1 Answer 1

up vote 0 down vote accepted

Thanks to a lot of help from @Mihai Todor, I figured out in the windows hosts file I can add this line:

10.10.10.10/public_html/dev/myapp/httpdocs/ myapp.dev

and then in IE under Internet Options -> Connections -> LAN Settings, I set my host machine's IP address as the proxy server on port 80, and it will work.

I'm not sure if using the host machine as a proxy is the proper way to handle this, but it seems to work. Thanks for your help.

share|improve this answer

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.