Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running Local Sites on all PCs on Network

Status
Not open for further replies.

PCHomepage

Programmer
Feb 24, 2009
609
1
16
US
On Windows 8.1 running Apache2, my hosts has something like:

Code:
127.0.0.1	localhost
#::1		localhost

127.0.0.1	site1.dev
127.0.0.1	site2.dev
127.0.0.1	site3.dev

. . . and I load site1.dev into the URL area of the browser to see the site. With the PC running Apache hard-coded to a specific IP address, what do I need to change here in order to see the development sites on any device on the network? I am using the httpd-vhosts.conf setup so this is the only place where the localhost and IP is used. I was thinking that I just needed to change it to the PC's static IP but then I'm not sure what to do with "localhost" as it doesn't seem proper to leave it that way.
 
localhost is ALWAYS going to be in the range 127.0.0.0/24

and yes it should be the IP of the remote machine running the webserver that should respond to that name.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
I was sure that localhost would not change but does that mean that I should change the rest to something like:

Code:
127.0.0.1	localhost
#::1		localhost

192.168.1.10	site1.dev
192.168.1.10	site2.dev
192.168.1.10	site3.dev

If so, I tried it on one but it is still not accessible on other devices on the network after flushing the DNS (ipconfig /flushdns) and restarting Apache - or do I need to reboot the system too? Is there something else that also needs to be changed?
 
For all machines to resolve all the hostnames every machine needs to have the same hosts file.

The hosts file was the original naming system in use on ARPANET but as the networks grew it was impractical to use for more that a few machines locally, so DNS was developed.

So to solve your problem you need to have a machine on-line running either Windows DNS server or BIND and that machine be referenced in the TCP/IP settings or by the network DHCP server.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Thank you, that makes sense and, now that you say it, I did know that at one time! I was hoping to be able to test sites locally on iPad/iPod/iPhone and other similar devices but unless I set up a DNS server as you suggested, that won't be possible just using the hosts file. I know my Cisco router has DNS functionality but that's probably not useful here.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top