Search code examples
apachewampapache-config

Set up WAMP server - getting 403


I want to put my website online. I am using WampServer 2.2. Now, I've set up wamp as follows:

<Directory />
  AllowOverride All
  Options All
  Require all granted
  Order allow,deny
</Directory>

Listen 81
<VirtualHost *:81>
  ServerName rti.etf.rs
  DocumentRoot "C:/wamp/www"
  DirectoryIndex index.php
</VirtualHost>

I've opened up port 81 in Windows Firewall. Now, when I try opening localhost:81 my webpage opens well. However, when I try accessing it with my external IP address 176.xxx.xxx.xxx:81, I get a 403 Forbidden error. I see these requests in the Apache access log, so I guess that part is set up well, but I must be missing something it the Apache configuration.

Edit: Put Online option is activated.

Any helpful ideas?


Solution

  • OK try this, you didn't specify which version of Apache you were using and you seem to have Apache 2.2 syntax mixed up with Apache 2.4 syntax so I have given both versions.

    Change this section back to how it was originally, this controls access to your C:\ and you just allowed full access to it, NOT GOOD.

    From

    <Directory />
      AllowOverride All
      Options All
      Require all granted
      Order allow,deny
    </Directory>
    

    to Apache 2.2.x syntax

    <Directory />
        Options FollowSymLinks
        AllowOverride None
        Order Deny,Allow
        Deny from all
    </Directory>
    

    Apache2.4.x syntax

    <Directory />
        Options FollowSymLinks
        AllowOverride None
        Require all denied
    </Directory>
    




    Now to your Virtual Hosts. This also need to have it's own security specified inside the block

    Listen 81
    <VirtualHost *:81>
      ServerName rti.etf.rs
      DocumentRoot "C:/wamp/www"
      DirectoryIndex index.php
    #### Apache 2.2 syntax
      <Directory "C:/wamp/www/">
         AllowOverride All
         Order Allow,Deny
         Allow from all
      </Directory>
    #### Apache 2.4 syntax
      <Directory "C:/wamp/www/">
         AllowOverride All
         Require all granted
      </Directory>
    </VirtualHost>
    

    PS. I cannot see any benefit in using port 81 and it just makes life more complicated for an external user.