Apache Forbidden Error WAMP

2019-08-01 01:54发布

Currently using WAMP 3.06 w/ Apache 2.4.23. Navigating to localhost on the server computer works perfectly, but when I try to go to the IP of the server on my network or the domain, I get a Forbidden on / error. My httpd.conf file has:

<Directory />
    AllowOverride none
    Require all denied
</Directory>

Thanks!

3条回答
ゆ 、 Hurt°
2楼-- · 2019-08-01 02:33

This small section of the httpd.conf file

<Directory />
    AllowOverride none
    Require all denied
</Directory>

protects the root folder of the drive that Apache is installed on from hacking (should you Apache server get hacked) by denying access to anything on that drive.

This is normal security practice, deny acces to everything, then specifically allow access to only what is needed to be accessible.

By default WAMPServer is configured as a single user, developer tool accessable only from the PC running WAMPServer. This is to protect beginners from any possibility of accidentally being hacked, as NOBODY can gain access to the Apache in WAMPServer from any IP Address other that the one running WAMPServer.

As of WAMPServer 3, we configured WAMPServer to have a Virtual Host defined for localhost. This means that in order to alter the default access to Apache, you have to edit the httpd-vhost.conf file accordingly.

Access to this file is provided from the wampmanager menu system via

(left click) wampmanager -> Apache -> httpd-vhost.conf

Click this and your editor will open this file.

It will look like this by default

#
# Virtual Hosts
#

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

In order to open up access to ip addresses on your LAN you can either add specific IP addresses like this

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

Or you can make it available to any ip address on your subnet by using just the first 3 quartiles of the subnet like this

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

Once this file is change, save it, and then restart Apache, again using the menus

wampmanager -> Apache -> Service Administration -> Restart Service

Then retry accessing apache from another pc on your LAN

查看更多
可以哭但决不认输i
3楼-- · 2019-08-01 02:39

The answer given by @RiggsFolly did the trick for me, but just to complement his/her post check your ip because in my case it was 192.168.0.

If you want to check your ip go to the console and type ipconfig for windows or ifconfig for linux/mac

查看更多
迷人小祖宗
4楼-- · 2019-08-01 02:40

By default, WAMP is set to only allow local access to the web server. "Require all denied" means just that - all requests are denied over the network.

Take a look at the Apache documentation for example configurations: https://httpd.apache.org/docs/2.4/howto/access.html

If this server isn't connected to the public internet, you can use "Require all granted" to give access to any client machine.

查看更多
登录 后发表回答