102

I have installed WAMP version 2.1 on my windows 7 machine. When i browse to localhost in my browser, the WAMP server page is visible.

But when I browse to my IP in my browser, I get the message

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

Any suggestions?

shabby
  • 3,002
  • 3
  • 39
  • 59
Jake
  • 16,329
  • 50
  • 126
  • 202
  • The access to your Apache server is forbidden from addresses other than `127.0.0.1` in `httpd.conf` (Apache's config file) – Nasreddine Nov 20 '11 at 21:37
  • I corrected that, now I am getting 403 Forbidden in my phpMyAdmin, any suggestions for that ? – Jake Nov 20 '11 at 21:42
  • there is also a `phpmyadmin.conf` that contains directives for the 'localhost/phpmyadmin' alias – Nasreddine Nov 20 '11 at 21:58
  • if you're here for windows 8 chk this http://stackoverflow.com/questions/13945783/wamp-forbidden-error-on-windows-8/20946636#20946636 – shabby Jan 06 '14 at 09:26

26 Answers26

126

The access to your Apache server is forbidden from addresses other than 127.0.0.1 in httpd.conf (Apache's config file) :

<Directory "c:/wamp/www/">
    Options Indexes FollowSymLinks
    AllowOverride all
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
</Directory>

The same goes for your PHPMyAdmin access, the config file is phpmyadmin.conf :

<Directory "c:/wamp/apps/phpmyadmin3.4.5/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order Deny,Allow
        Deny from all
        Allow from 127.0.0.1
</Directory>

You can set them to allow connections from all IP addresses like follows :

AllowOverride All
Order allow,deny
Allow from all
Nasreddine
  • 36,610
  • 17
  • 75
  • 94
  • 7
    This will certainly open up access from any IP address, but isnt that a little dangerous? The rule to allow 'from 127.0.0.1' should be enough to allow local access, if that is the main objective here, the 127.0.0.1 is basically a loop back to the network adaptor. If you type in the address bar 'http'://127.0.0.1:{portNumber}/{folderOrFileName}' it should work fine. This should work the same as using localhost, but I have found some browsers have issues with localhost for some reason. – Jeremy May 01 '12 at 19:50
  • I couldnt format my address line in that last comment so there's an extra "'" in it just ignore that sorry if it confuses anyone. – Jeremy May 01 '12 at 19:57
  • Note: the file sets defaults which are then overridden one at a time afterward, so make sure these lines go after all of the overrides. – meetar May 11 '12 at 20:09
  • 3
    Don't forget to "Restart All Services" from the WAMP system tray menu (or however you do it.) – Plummer Nov 08 '13 at 19:00
  • 14
    **For Apache version 2.4.x** replace `Require local` with `Require all granted` in _httpd.conf file_ inside `` tag then **Restart all services** – Rakesh Feb 12 '16 at 12:13
  • Make sure to check **extra/https-vhosts.conf**. It might also contain a `Require local`, but it will not get overwritten by setting wampserver online. – Lajos Mészáros Jun 12 '17 at 14:21
62

I found a simpler fix...

Although the icon was green WAMP still needs to be "Put Online" (last item of menu when left-clicking icon).

After that I had access as normal.

Bobs Yeruncle
  • 621
  • 5
  • 2
  • 3
    Actually, this should be flagged as an accepted answer. Thank you dude. – ummahusla Aug 09 '15 at 21:09
  • This solution deserve an upvote because the config is updated when you actualy click on the put online button : http://forum.wampserver.com/read.php?1,119467,119546 – GPY Aug 12 '15 at 09:12
  • This fixed it for me too. Though in my case I had to first "Put offline", then "Put online" and worked without any other changes to my config files! Thank you!! – Osmar Apr 18 '16 at 03:59
  • 1
    Actually, I began making all those things in the first, accepted answer. And it did not help. Then I saw this here, and I thought 'No way it can be this...', but, it was that and it worked. – Fusseldieb Sep 18 '16 at 03:55
  • Supercalifragilisticexpialidocious! – Vahid Nov 19 '16 at 06:31
26

For me the inclusion of "Require local" helped to solve Error 403. The alias config file looks like this:

Alias /mytest/ "C:/mytest/" 

<Directory "C:/mytest/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order allow,deny
    Allow from all
    Require local
</Directory>
Girts Strazdins
  • 848
  • 9
  • 15
10

The solution for changing the permissions in the httpd.conf will work if you are OK with providing access to the WAMP server from outside.

If you do not want to do that then all you have to do is tell windows that the "localhost" domain points to 127.0.0.1. You can do that by editing the hosts file in your system directory.

The file is placed at : C:\Windows\System32\drivers\etc\hosts

by default windows 7 ships with :

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost

You have to un-comment the mapping for localhost:

# localhost name resolution is handled within DNS itself.
127.0.0.1       localhost
#   ::1         localhost

Note: you will not be able to edit the hosts file as its a read-only file. To edit, you have to be the administrator, copy the file to some other location, edit it and then copy it back to the etc directory.

I do not recommend the change of the hosts file. Use the permissions of httpd.conf file. use the hosts file approach only if you do not want the server accessed from outside.

Punit Raizada
  • 494
  • 6
  • 11
8

Try adding the following lines of code to the file httpd-vhosts.conf:

<VirtualHost *:80>
ServerAdmin serveradmin@host.com
DocumentRoot "C:\wamp\www"
ServerName localhost
</VirtualHost>
WADeveloper
  • 81
  • 2
  • 4
8

For Wamp 3.1.3 and Apache 2.4 I simply had to change 1 line in my httpd-vhosts.conf file.

  1. Open httpd-vhosts.conf
  2. Change "Require local" to "Require all granted"
  3. Restart all services

I was then able to get to my apache server from other computers.

Give credit to this video: https://www.youtube.com/watch?v=Sy_f6wBGnjI

EldritchText
  • 121
  • 1
  • 2
  • 7
7

Another thing I found out is that if your network adapter uses IPV6, it will not show as 127.0.0.1 but ::1

What I ended up doing is this:

<Directory "c:/wamp/www/">
    Options Indexes FollowSymLinks
    AllowOverride all
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
    Allow from ::1
</Directory>

The same goes for your PHPMyAdmin access, the config file is phpmyadmin.conf :

<Directory "c:/wamp/apps/phpmyadmin3.4.5/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order Deny,Allow
        Deny from all
        Allow from 127.0.0.1
        Allow from ::1
</Directory>
Geekhuh
  • 93
  • 1
  • 9
  • I think this answer really addresses the important thing that's being asked, namely that when IPv6 is enabled, localhost resolves to an IPv6 address (::1) and which in turn means that the requesting address will also be an IPv6 address (also ::1) which is NOT the same as 127.0.0.1 which is the only address from which connections are allowed. Also, localhost resolves through the local DNS server by default (not the hosts) and it's just better-looking according to me to leave it that way and instead either disable IPv6 so that localhost resolves to 127.0.0.1 or change / include as above. – fast-reflexes Mar 20 '13 at 09:09
  • just adding 'Allow from ::1' to "c:\wamp\alias\phpmyadmin.conf file" solved phpmyadmin 403 problem. – ewroman Mar 03 '16 at 22:09
4

if you have used localhost/phpmyadmin/

simply use

127.0.0.1/phpmyadmin/ for PHPMyAdmin

127.0.0.1/sqlbuddy/ for SQLBuddy

or if you have used localhost:8080/phpmyadmin/ then

127.0.0.1:8080/phpmyadmin/ for PHPMyAdmin

127.0.0.1:8080/sqlbuddy/ for SQLBuddy

Community
  • 1
  • 1
suiz
  • 377
  • 1
  • 2
  • 13
4

Remember to remove dummy elements in httpd-vhosts.conf

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "c:/Apache24/docs/dummy-host.example.com"
    ServerName dummy-host.example.com
    ServerAlias www.dummy-host.example.com
    ErrorLog "logs/dummy-host.example.com-error.log"
    CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "c:/Apache24/docs/dummy-host2.example.com"
    ServerName dummy-host2.example.com
    ErrorLog "logs/dummy-host2.example.com-error.log"
    CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>
4

For Apache version 2.4.x simply replace Require local with Require all granted in httpd.conf file inside <Directory "c:/wamp/www/"> tag then Restart all services

Rakesh
  • 706
  • 6
  • 10
  • 1
    This did the trick for me. Strange thing is that 2 other VirtualHosts (in httpd-vhosts.conf) don't have 'Require local' or 'Require all granted', and still work fine. ¯\_(ツ)_/¯ – kmdsax Aug 25 '17 at 16:08
2

There could many causes to this problems

What I have experienced are:
1) 127.0.0.1 localhost entry was duplicated in hosts file
2) Apache mod_rewrite was not enabled

Regardless of the cause, backing up your www folder, vhost configuration file (and httpd configuration file) will help. And such process takes a few minutes.

Good luck

ericn
  • 12,476
  • 16
  • 84
  • 127
2

I read & tried All Fixes But Not one worked. At last i Found that the Wamp Server Logo Is Green But Need to Be "PUT ONLINE". So simple & a Quick Fix After Checking Your PHPMyAdmin.Cofg & HttPD.cofg Just Click on PUT ONLINE

mdml
  • 22,442
  • 8
  • 58
  • 66
Nexones
  • 21
  • 1
1

I tried the configs above and only this worked for my WAMP Apache 2.4.2 config. For multiple root site without named domains in your Windows hosts file, use http://locahost:8080, http://localhost:8081, http://localhost:8082 and this configuration:

#ServerName localhost:80
ServerName localhost

Listen 8080
Listen 8081
Listen 8082
#..... 
<VirtualHost *:8080>
    DocumentRoot "c:\www"
    ServerName localhost
    <Directory "c:/www/">
        Options Indexes FollowSymLinks
        AllowOverride all
        Require local
    </Directory>
</VirtualHost>
<VirtualHost *:8081>
    DocumentRoot "C:\www\directory abc\svn_abc\trunk\httpdocs"
    ServerName localhost
    <Directory "C:\www\directory abc\svn_abc\trunk\httpdocs">
        Options Indexes FollowSymLinks
        AllowOverride all
        Require local
    </Directory>
</VirtualHost>
#<VirtualHost *:8082></VirtualHost>.......
s6712
  • 496
  • 5
  • 14
1

I faced this issue with wamp on windows 7. Adding following code to httpd-vhosts.conf solved the issue for me.

<VirtualHost *:80>
  DocumentRoot "F:/wamp_server/www/"
  ServerName localhost
</VirtualHost>
Vishal
  • 39
  • 3
1

Thanks for your question. I'am using wamp 3 now. And I find an simple answer to do this under your question. But that answer should change a little on wamp 3. The steps are as following:

  1. Right click wamp icon
  2. Choose Wamp Setting
  3. Click the Menu item:online/offline
  4. Left click wamp icon
  5. You will find there is a new item called "Put online"
miltonb
  • 6,905
  • 8
  • 45
  • 55
Smart Du
  • 21
  • 3
1

It took me forever to figure this out.

C:\wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf

In this file you will notice several example virtual host files, that look like:

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "c:/Apache24/docs/dummy-host.example.com"
    ServerName dummy-host.example.com
    ServerAlias www.dummy-host.example.com
    ErrorLog "logs/dummy-host.example.com-error.log"
    CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "c:/Apache24/docs/dummy-host2.example.com"
    ServerName dummy-host2.example.com
    ErrorLog "logs/dummy-host2.example.com-error.log"
    CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>

Simply delete these entries and replace with:

<VirtualHost *:80>
    ServerAdmin serveradmin@host.com
    DocumentRoot "C:\wamp\www"
    ServerName localhost
</VirtualHost>

You definitely need to make sure your other ducks are in a row but this for me with the solution that worked.

Aaron S.
  • 11
  • 2
0

hi there are 2 solutions :

  1. change the port 80 to 81 in the text file (httpd.conf) and click 127.0.0.1:81

  2. change setting the network go to control panel--network and internet--network and sharing center

click-->local area connection select-->propertis check true in the -allow other ..... and --- allo other .....

Lodder
  • 19,758
  • 10
  • 59
  • 100
0

I had this problem too. The route of my problem was I had made a mistake in my vhosts.conf file. If you are using vhosts this is another thing to check

Pattle
  • 5,983
  • 8
  • 33
  • 56
0

This configuration in httpd.conf work fine for me.

<Directory "c:/wamp/www/">
    Options Indexes FollowSymLinks
    AllowOverride all
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1 ::1
</Directory>
Fabio
  • 141
  • 4
  • 13
0

Make sure you aren't using a Windows' directory separator character (backslash) in your path names in your .conf file, even if you are on Windows. Apache doesn't understand them but will still start up and then output a 403 Forbidden Message.

wrong:

<Directory "c:\websites\my-website\">

right:

<Directory "c:/websites/my-website/">
David Murdoch
  • 87,823
  • 39
  • 148
  • 191
0

Surprisingly, square brackets in DocumentRoot (and related, like <Directory>) paths can also cause error 403:

  • DocumentRoot "P:/TRY/web/fatfree/from_github/fatfree-master[bang]" failed with 403, while
  • DocumentRoot "P:/TRY/web/fatfree/from_github/fatfree-master" worked fine.

(I didn't bother figuring out the Apache path escaping, if any, just renamed the path instead. If anyone knows, comments are welcome.)

Sz.
  • 3,342
  • 1
  • 30
  • 43
0

Also on Apache 2,4 you may need to add this to the directory directive in conf, in case you decided to include httpd-vhosts.conf.

By default you can install wamp in C:\ but still choose to deploy your web development in another location.

To do this inside the vhosts.conf you can add this directive:

<Directory "e:/websites">
    Options Indexes FollowSymLinks MultiViews
    DirectoryIndex index.php
    AllowOverride All
  <IfDefine APACHE24>
    Require local
  </IfDefine>
  <IfDefine !APACHE24>
    Order Deny,Allow
    Allow from all
    Allow from localhost ::1 127.0.0.1
  </IfDefine>
</Directory>
Gerald Schneider
  • 17,416
  • 9
  • 60
  • 78
amresh tripathi
  • 121
  • 1
  • 5
0

I have tried all the stuff except clearing the mess in .htaccess file.

Go to www/ directory and make a copy of .htaccess file in another folder. Then clear all the lines in .htaccess original file. And add this line,

RewriteEngine On

Then restart the server. This has solved my problem and got access to all my localhost sites. Hope it would solve yours too.

siddhu151dj
  • 101
  • 1
0

My solution was to disable encoding for encoded files (these files are green in windows). Ive got these files from MAC computer and it was encrypted by default.

Ive select these files > right click > properities > general tab > andvanced > uncheck encrypt files...

And voila it works.

petkopalko
  • 600
  • 7
  • 18
0

make sure that, the name of the file in the directory c:/wamp/apps/phpmyadmin3.1.3.1/, match the name (or version) in the phpMyAdmin.conf (Alias /phpmyadmin "c:/wamp/apps/phpmyadmin3.1.3.1/" )

Kurt Van den Branden
  • 11,995
  • 10
  • 76
  • 85
M.Yousif
  • 21
  • 4
0

I have found that if you are using ammps that for some reason its always forbidden when its in your root folder so i put it in the directory above my root folder and made a alias in the httpd.conf using this

Alias /phpmyadmin "C:/Program Files (x86)/Ampps/phpMyAdmin"

please note i am using ammps and i dont know for sure if it will work for others but its worth a try ;)

Nik Hendricks
  • 45
  • 1
  • 12