httpd.conf 文件的这一小节
<Directory />
AllowOverride none
Require all denied
</Directory>
通过拒绝访问该驱动器上的任何内容来保护安装 Apache 的驱动器的根文件夹免受黑客攻击(如果 Apache 服务器被黑客攻击)。
这是正常的安全做法,拒绝访问所有内容,然后明确允许仅访问需要访问的内容。
默认情况下,WAMPServer 配置为单用户,开发人员工具只能从运行 WAMPServer 的 PC 访问。这是为了保护初学者免受任何意外被黑客攻击的可能性,因为没有人可以从运行 WAMPServer 的 IP 地址以外的任何 IP 地址访问 WAMPServer 中的 Apache。
从 WAMPServer 3 开始,我们将 WAMPServer 配置为具有为 localhost 定义的虚拟主机。这意味着要更改对 Apache 的默认访问权限,您必须相应地编辑 httpd-vhost.conf 文件。
通过 wampmanager 菜单系统提供对该文件的访问权限
(left click) wampmanager -> Apache -> httpd-vhost.conf
单击此按钮,您的编辑器将打开此文件。
默认是这样的
#
# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
DocumentRoot D:/wamp/www
<Directory "D:/wamp/www/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
为了在您的 LAN 上开放对 IP 地址的访问,您可以像这样添加特定的 IP 地址
<VirtualHost *:80>
ServerName localhost
DocumentRoot D:/wamp/www
<Directory "D:/wamp/www/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require local
# New line
Require ip 192.168.1.111
</Directory>
</VirtualHost>
或者您可以像这样仅使用子网的前 3 个四分位数使其可用于子网上的任何 IP 地址
<VirtualHost *:80>
ServerName localhost
DocumentRoot D:/wamp/www
<Directory "D:/wamp/www/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require local
# New line
Require ip 192.168.1
</Directory>
</VirtualHost>
更改此文件后,保存它,然后重新启动 Apache,再次使用菜单
wampmanager -> Apache -> Service Administration -> Restart Service
然后重新尝试从局域网上的另一台电脑访问 apache