【发布时间】:2018-09-28 11:45:35
【问题描述】:
我尝试将我的项目设为“公开”,以便局域网中的每个人都可以访问它。
目前我只能通过http://localhost/project 或他们的虚拟主机名访问我的项目,例如http://myVirtualHostName.
我需要在我的整个 LAN 中都可以访问这些项目,例如像这样:
http://192.168.1.123/project 或http://192.168.1.123/myVirtualHostName。
但如果我尝试从自己的客户端或局域网中的另一台计算机访问项目,我会收到403 Forbidden: You don't have permission to access /projectName/ on this server.。
编辑:
我能够解决第一个问题,感谢answer,我现在可以访问C:\wamp64\www 下的链接,方法是更改C:\wamp64\bin\apache\apche2.4.33\conf\extra\httpd-vhosts.conf 中的以下块
来自
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
</Directory>
</VirtualHost>
到
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
...并在它之后重新启动 apache。
现在我可以像http:\\192.168.1.123\myProjekt 一样访问C:\wamp64\www 中的项目。但是我仍然不知道如何使用我的服务器 ip 地址访问虚拟主机。
如果我尝试http://192.168.1.123/myVhostName,那么我会得到Not Found
The requested URL /myVhostName was not found on this server.,即使为每个virtual host 设置了Require all granted。
我还重新启动了 DNS 服务器。
我该如何解决这个问题?
我正在使用 WAMP 3.1.3。
【问题讨论】:
标签: apache wamp virtualhost