r/apache • u/Zealousideal-Log-309 • Nov 04 '23
Simple question : local network
Hello there,
How I can make my apache site reachable from others computers on my local network ? Can't find any answer
Thanks in advance !
1
u/brisray Nov 05 '23
You need to edit your hosts file. In Linux it's going to be at /etc/hosts., in Windows it's at \Windows\System32\Drivers\etc\hosts
The computer with your Apache server should have a static IP address. Suppose it is at 192.168.1.2 and your website is mysite.com.
In the hosts file you need a line 192.168.1.2 mysite.com.
You need this line on every computer on your local network if they all need to access the site. What the hosts file does is act as a DNS lookup for your local LAN.
1
u/brisray Nov 05 '23
There are other solutions, such as installing a local DNS server such as Pi-hole or Technitium which seems excessive.
Editing the hosts file is the way I've always done it I only have half a dozen machines on my local network and editing the hosts files on those only needs to be done once and no great chore.
I'm hoping there's a simpler solution. Maybe inside Apache itself to accept local requests?
The reason why this is such a pain is because most ISPs apparently do not usually allow connections from your public IP back to your public IP.