Testing subdomains locally

0

I have my development server on a locally hosted virtual machine. The VM is running Ubuntu and the host is Windows 8. I have samba installed on the VM, so I can access it by hostname. Everything works great, except for the fact that I would like to start testing subdomains in my project.

Apache config which I believe is appropriate for what I'm trying to do:

<VirtualHost *:80>
        ServerName foo
        ServerAlias *.foo

        DocumentRoot /home/foo/sites/foo/www

        <Directory /home/foo/sites/foo>
                Options Indexes FollowSymLinks
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
</VirtualHost>

Now, I know that I can do something similar by adding entries into /etc/hosts on the VM, or by using something like dnsmasq. However, with either of those methods, the subdomains do not get carried over to the host, ie. I cannot enter en.foo on my Windows 8 machine and see the same thing I see when I enter just foo.

Is it possible to accomplish this without having to resort to a DNS proxy, and setting my Windows machines' DNS address to that of the proxy?

Radu

Posted 2013-01-27T23:07:16.227

Reputation: 359

Answers

1

You need to add the hosts file entries into your Windows 8 machine so that your web browser can send them through HTTP to your VM.

The file has the same format as on Unix-based systems, and can be found at C:\Windows\system32\drivers\etc\hosts

CyberJacob

Posted 2013-01-27T23:07:16.227

Reputation: 458