Windows – access virtual hosts from one computer directly by their IP address from another without configuring the hosts file

apache-2.2hostvirtualhostwindowsxampp

I set up a couple virtual hosts in order to point to different resources on the network that I want accessible from links on my index page. I set these to ports 81 and 82. On my index page, I link directly to the IP, like so: <a href="http://127.0.0.1:81">

I assumed this would let me get away with not configuring the host file to look for the server name. I'm setting up a simple information-distributing intranet to make accessing certain files easier for about 60 computers, so it's easier if I don't have to modify all of their host files.

This method works locally, but not from another computer. From another computer, I can access my computer's XAMPP root directory /htdocs by navigating to the computer name, which gives me my main index, but the link are broken. Is there any other way I can link to these vhosts from my index that will work on a different computer?

Best Answer

127.0.0.1 is localhost, meaning "this machine", so naturally you can't use that to connect to a service on another machine. You need to use the actual ip address of the server hosting that service.

The hosts file is used to resolve names to ip addresses. If you're accessing the server by ip address then the hosts file wouldn't be used.