【发布时间】:2019-02-18 19:29:38
【问题描述】:
我全新安装了 WAMPServer,除了能够从网络上的任何其他计算机连接到 APACHE 之外,一切都运行良好。我假设这仅与此处的 APACHE 有关,防火墙和路由器将是其他潜在的瓶颈。
我只需要使用附加子网修改默认 VHost 还是需要同时修改两者?
#
# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
DocumentRoot c:/wamp/www
<Directory "c:/wamp/www/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require local
Require ip 192.168.3 <====== add here and below or only here
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName myhost
DocumentRoot c:/wamp/www/myhost
<Directory "c:/wamp/www/myhost">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require local
Require ip 192.168.3 <========== or only here or both
</Directory>
</VirtualHost>
【问题讨论】:
-
VHOST 定义看起来正确。但是你有没有告诉对方如何通过将WAMPServer机器的IP地址添加到对方机器的HOSTS文件中找到
myhost? -
HOSTS
192.168.3.100 myhost(其中192.168.3.100是 WAMPServer PC 的 IP。一旦定义了 VHOST,您必须使用 ServerName 来寻址该站点,否则 Apache 不会知道要查找它 -
我希望只将
Require ip 192.168.3添加到您想从网络上的另一台 PC 访问的站点 -
感谢 Riggs,是的,从客户端访问服务器需要 IP 地址或修改客户端上的 hosts 文件。因此,将 WAMP 服务器的默认主机保留为没有“Require ip 192.168.3”对其他虚拟主机没有影响,它们独立运行吗?在我的示例中,我在从同一子网上的另一个客户端连接时遇到了一些问题,只是试图找出瓶颈在哪里……防火墙、路由器或 APACHE 设置。有没有办法测试或验证 APACHE 是否接受该子网的连接?
标签: wampserver