简体   繁体   中英

local host connection in same network

I am trying to connect to my localhost from another computer. I have changed the host files to add the following at the end of the file: 127.0.0.1 privacy.local

And in my httpd-vhosts, I've added the following: DocumentRoot "/xampp/htdocs/app/" ServerName privacy.local

On my computer, I able able to access my website using privacy.local and my IP address. However, when I try to access this from my other computer, it does not work. I have also edited the host file for the other computer with my IP address and the servername.

Does anyone know why and how to fix this problem?

I am using xampp - apache.

There is nothing like a localhost in a network. You connect a host at a network adapter. The localhost is a virtual adapter to allow connections at one host without specifying the IP address of a network card. Each host has it's own localhost .

You must use the IP address of the adapter that is used to connect to the network, usually the one and only network card.

If you have DNS support you should use the host name instead of the IP address, because the IP address can change if it's assigned by DHCP.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM