使用Apache主办的本地网络上的网站 [英] Using Apache to host websites on local network

查看:181
本文介绍了使用Apache主办的本地网络上的网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前使用Apache我的机器上本地测试PHP网站。我只是想知道我怎么能允许连接到我的本地网络计算机访问托管我的本地机器上的网站。

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.

推荐答案

在机器本地网络应该可以,如果只能通过IP来访问你的机器,(假设你没有防火墙阻止端口80(HTTP)。

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).

一旦这样做了,你可以在你的httpd.conf设置虚拟主机(看在最底层,应该有一些样本指令,让你开始)。

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).

如果您希望机器能在你的机器上访问多个不同的网站,那么你需要在你的虚拟主机的设置来创建本地/假的域名,也欺骗自己.hosts文件中的DNS(C:\\ WINDOWS \\ SYSTEM32 \\ DRIVERS \\ Windows机器上等等\\主机)。

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).

从本质上讲什么,你会做的是告诉他们的机器,该网站www.testsite.local可以在IP地址XXXX到达,然后你的虚拟主机的指令会告诉阿帕奇该网站www.testsite.local可以发现在/ home / user中/的public_html /

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/

这篇关于使用Apache主办的本地网络上的网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆