Forum Moderators: phranque
I have setup apache under linux with a virtual host recognizing the domain name, and I have modified my /etc/hosts file on this server so that at least local browsing on the linux box resolves to the local machine, as well as mysql requests, etc.
How can I set up my other computers in the LAN to obtain this DNS override? Should I try to set up a dns server on the linux box? What about setting up a http proxy on the linux server, and when I want to work on development, change my browser settings to use the proxy? What's the best way to handle this?
FYI, one experiment I tried on my local Windows machines was modifying the \windows\system32\drivers\etc\hosts file, which didn't seem to work right. When it would resolve and bring up the linux server page, the linux server would give me the default document root on the apache server, instead of the development virtual host document root (if that makes sense?).
Thanks,
Dustin
The local server /hosts file should point your domain to 127.0.0.1 or localhost, while the other PCs' /hosts files should point your doamin name to the local IP address of your server, like 192.168.1.1 or something.
Jim
From the other machines however, if I change my host and browse to www.mydomain.com, it takes me to the server's default document root, which is just /var/www/html, instead of /var/www/html/mydomain.
Is there anything in particular I should look for in my server settings to resolve this? I was worried that maybe my other machines were resolving mydomain.com to 192.168.1.1 and then querying the server with the ip address and no domain name. If that's the case, it wouldn't look to the virtual host for its document root, it would have no knowledge of the fact that the original request (prior to domain name resolution) was for mydomain.com.
Thanks,
Dustin
[httpd.apache.org...]
NameVirtualHost 111.22.33.44:80
<VirtualHost 111.22.33.44:80>
ServerName www.domain.tld
DocumentRoot /www/domain-80
</VirtualHost>
<VirtualHost 111.22.33.44:80>
ServerName www.otherdomain.tld
DocumentRoot /www/otherdomain-80
</VirtualHost>
Works like a charm..