Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WAMP Cannot access on local network 403 Forbidden

I know this question has been asked a lot of times

I followed Most of the answers in the internet But I still get the same Message

403 Forbidden

You don't have permission to access / on this server.

It is weird that when I access using the same PC to localhost:1234 it runs normally but if I access using my IP address 192.168.0.188:1234

Also which is really weird is that I tried to install WAMP on other PC and without any configuration I could access to that PC.

So I thought it's because McAfee and Firewall so I open port on Widows and McAfee and nothing changed also I turned off Firewall and still nothing change.

Then for no reason I opened port through the Router “port forwarding” and still nothing changed.

I don't think that it's because my configuration in WAMP since I am still able to get this 403 Forbidden Message and also by using other PC without any configuration I could access it.

Both PCs are setup like this:

Windows 8 Pro

  • WAMP Wampserver: 2.4
  • Apache Version: 2.4.4
  • PHP Version: 5.4.12
  • MySQL Version: 5.6.12

The accessible PC uses Microsoft Security Essentials.

The inaccessible PC uses McAfee Internet Security.

I tried to turn off WAMP and start IIS For Microsoft Server (I works perfectly From any PC) but WAMP is still not not working

I followed these tutorial:

  • How to Access WAMP Server in LAN or WAN
  • Install & Setup Virtual Host Guide for WAMP
  • Install & Setup LAN & Worldwide Access Guide for WAMP

And the Stack Overflow answers here:

  • Cannot access wamp server on local network
  • WAMP 403 Forbidden message on Windows 7
like image 907
Ahmad Saleh Avatar asked Apr 30 '14 07:04

Ahmad Saleh


People also ask

How do I give permission to WAMP server?

Choose the file httpd. conf. Under the Directory tab section (section with "# Online --> Require all granted" text), I had the "Require local" option which I changed to "Require all granted" Restart all services of the WAMP.

What is 403 Forbidden And how do you fix it?

A 403 error occurs when a server won't allow you to access a webpage. You can't always fix a 403 error on your own, but simple tricks like refreshing your page or clearing your cache could help. If visitors to your webpage are getting 403 errors, you may have to reconfigure it.


2 Answers

If you are using WAMPServer 3 See bottom of answer

For WAMPServer versions <= 2.5

By default Wampserver comes configured as securely as it can, so Apache is set to only allow access from the machine running wamp. Afterall it is supposed to be a development server and not a live server.

Also there was a little error released with WAMPServer 2.4 where it used the old Apache 2.2 syntax instead of the new Apache 2.4 syntax for access rights.

You need to change the security setting on Apache to allow access from anywhere else, so edit your httpd.conf file.

Change this section from :

#   onlineoffline tag - don't remove      Order Deny,Allow      Deny from all      Allow from 127.0.0.1      Allow from ::1      Allow from localhost 

To :

#   onlineoffline tag - don't remove     Require local     Require ip 192.168.0 

The Require local allows access from these ip's 127.0.0.1 & localhost & ::1.

The statement Require ip 192.168.0 will allow you to access the Apache server from any ip on your internal network. Also it will allow access using the server mechines actual ip address from the server machine, as you are trying to do.

WAMPServer 3 has a different method

In version 3 and > of WAMPServer there is a Virtual Hosts pre defined for localhost so you have to make the access privilage amendements in the Virtual Host definition config file

First dont amend the httpd.conf file at all, leave it as you found it.

Using the menus, edit the httpd-vhosts.conf file.

enter image description here

It should look like this :

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

Amend it to

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

Hopefully you will have created a Virtual Host for your project and not be using the wamp\www folder for your site. In that case leave the localhost definition alone and make the change only to your Virtual Host.

Dont forget to restart Apache after making this change

like image 158
RiggsFolly Avatar answered Oct 12 '22 17:10

RiggsFolly


For Apache 2.4.9

in addition, look at the httpd-vhosts.conf file in C:\wamp\bin\apache\apache2.4.9\conf\extra

<VirtualHost *:80> ServerName localhost ServerAlias localhost DocumentRoot C:/wamp/www <Directory "C:/wamp/www/"> Options Indexes FollowSymLinks MultiViews AllowOverride all Require local </Directory> </VirtualHost> 

Change to:

<VirtualHost *:80> ServerName localhost ServerAlias localhost DocumentRoot C:/wamp/www <Directory "C:/wamp/www/"> Options Indexes FollowSymLinks MultiViews AllowOverride all Require all granted </Directory> </VirtualHost> 

changing from "Require local" to "Require all granted" solved the error 403 in my local network

like image 30
Michel Avatar answered Oct 12 '22 15:10

Michel