Wamp服务器Put Online无效

时间:2016-08-23 08:57:20

标签: apache wamp wampserver

我执行了以下步骤来设置Wamp,但无法从网络中的其他计算机访问服务器。我做错了什么?

  1. 已安装的Wamp 64 Bit版本3.0.4,它附带Apache版本2.4.18
  2. 启动Wamp服务器,右键单击系统托盘图标,选择Menu item : Online / Offline下的Wamp settings
  3. 点击(左键单击)系统托盘图标,然后选择Put Online
  4. 当我尝试从网络中的其他计算机访问服务器时,服务器返回错误页面,并显示错误消息You don't have permission to access / on this server
  5. 我直接编辑了httpd-vhosts.conf文件并重新启动了所有服务,仍然得到同样的错误。以下是httpd-vhosts.conf文件和我的系统IP

    的内容

    的httpd-vhosts.conf

    #
    # Virtual Hosts
    #
    
    <VirtualHost *:80>
        ServerName localhost
        DocumentRoot C:/Users/dinesh/Softwares/Wamp64/www
        <Directory  "C:/Users/dinesh/Softwares/Wamp64/www/">
            Options +Indexes +FollowSymLinks +MultiViews
            AllowOverride All
            Require local
            Require ip 100.97.67
        </Directory>
    </VirtualHost>
    

    系统IP

    mintty> ipconfig | grep IPv4
       IPv4 Address. . . . . . . . . . . : 100.97.67.11
    mintty>
    

4 个答案:

答案 0 :(得分:6)

 #
 # Virtual Hosts
 #

    <VirtualHost *:80>
        ServerName localhost
        DocumentRoot D:/wamp/www
        <Directory  "D:/wamp/www/">
            Options +Indexes +FollowSymLinks +MultiViews
            AllowOverride All
            Require local
        </Directory>
    </VirtualHost>
 #

REPLACE BY

 #
 # Virtual Hosts
 #

    <VirtualHost *:80>
        ServerName localhost
        DocumentRoot D:/wamp/www
        <Directory  "D:/wamp/www/">
            Options +Indexes +FollowSymLinks +MultiViews
            AllowOverride All
            #Require local
        </Directory>
    </VirtualHost>
 #

答案 1 :(得分:2)

Put Online/ Offline菜单项已设为可选项,默认情况下不可见,因为它在WAMPServer 3中基本上不再有任何功能。

在WAMPServer 3中,现在为localhost定义了一个虚拟主机,它占用了httpd.conf文件中定义的localhost。

如果你看一下新菜单结构,Apache菜单中有一个名为httpd-vhosts.conf的新菜单项,见下文

enter image description here

这会将Apache Virtual Host定义文件加载到defautl编辑器中。它应该是这样的:

#
# Virtual Hosts
#

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot D:/wamp/www
    <Directory  "D:/wamp/www/">
        Options +Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

要允许从网络上的特定计算机进行访问,例如

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot D:/wamp/www
    <Directory  "D:/wamp/www/">
        Options +Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
        Require ip 192.168.1.100
        Require ip 192.168.1.101
    </Directory>
</VirtualHost>

或者允许网络访问中的所有PC只将4个四分位数中的前3个添加到require,并且该子网内将允许任何IP

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot D:/wamp/www
    <Directory  "D:/wamp/www/">
        Options +Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
        Require ip 192.168.1
    </Directory>
</VirtualHost>
  

如果您没有看到此菜单,则需要从此处https://sourceforge.net/projects/wampserver/files/WampServer%203/WampServer%203.0.0/Updates/wampserver3_x86_x64_update3.0.5.exe/download升级到WAMPServer 3.0.5   这是对WAMPServer 3.0.4的简单升级

或者,只需直接编辑\wamp\bin\apache\apache{version}\conf\extra\httpd-vhosts.conf文件。

  

不要忘记在更改此文件后重启Apache。

答案 2 :(得分:0)

如果您已完成其他答案建议的所有操作,但仍无法正常工作,请确保其他应用程序未使用您的端口80。

要快速检查,请在命令提示符中运行 netstat -a -b 命令。

在我的情况下,Skype使用端口80,我可以通过进入Skype的高级设置来停止。

答案 3 :(得分:0)

我有一个令人烦恼的问题。 Windows防火墙具有允许apache通过的规则,但这是apache的早期版本,因此不适用于新的。必须在规则中更新apache的版本并将其添加到private-section。 Windows 10。

相关问题