Search code examples
apachewampserver

Apache Forbidden Error WAMP


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!


Solution

  • 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