Using Apache to host websites on local network
Asked Answered
E

2

6

I currently use Apache on my machine to test PHP websites locally. I was just wondering how I can allow computers connected to my local network to access the website hosted on my local machine.

Ecumenicism answered 7/4, 2011 at 6:19 Comment(1)
You should be able to visit yourip e.g. 192.168.1.2Forthwith
E
6

Machines on your local network should be able to access your machine, if only by IP (assuming you don't have a firewall blocking port 80 (HTTP).

Once that's done, you can setup Virtual Hosts in your httpd.conf (look at the very bottom, there should be some sample directives to get you started).

If you want the machines to be able to access multiple different websites on your machine, then you'll need to create local/fake domain names in your VirtualHost setup and also spoof the dns in their .hosts files (c:\windows\system32\drivers\etc\hosts on windows machines).

Essentially what you'll be doing is telling their machines that the website www.testsite.local can be reached at the ip address x.x.x.x, and then your VirtualHost directives will tell apache that the website www.testsite.local can be found at /home/user/public_html/

Encampment answered 7/4, 2011 at 6:26 Comment(2)
How would I check whether or not the port is blocked on Windows 7? I tried accessing from another computer in my local network and it doesn't work.Ecumenicism
See excellent step-by-step instructions here: dummies.com/how-to/content/… You want to open port 80 using TCP.Encampment
W
1

Providing you enabled the settings during the initial configuration, it should just be a case of entering the IP address of the computer hosting Apache into a web browser on another computer. Check that the ports are open and no firewalls are blocking the application.

Wallinga answered 7/4, 2011 at 6:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.