Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

closed as off-topic by Michael Hampton Nov 28 '15 at 9:50

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on Server Fault must be about managing information technology systems in a business environment. Home and end-user computing questions may be asked on Super User, and questions about development, testing and development tools may be asked on Stack Overflow." – Michael Hampton
If this question can be reworded to fit the rules in the help center, please edit the 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. – Jeremy Harris 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. – Jeremy Harris 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
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

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