All localhost pages via WAMP blocked?
Asked Answered
V

8

13

I've been trying to fix a weird 403 Forbidden error I get when I try to go to one of my pages via WAMP on the localhost.

After adding a rule to open up port 80 via Windows Firewall, which apache uses, I notice that this does NOT fix my problem and instead gives me a 403 forbidden for ALL my pages via localhost.

Removing the rule I just made (which caused this to begin with) does not fix it. Disabling Windows Firewall does not fix it. Restarting my computer does not fix it. Any ideas?

EDIT2: I AM able to go to localhost/phpmyadmin for whatever that's worth.

Vanadous answered 9/6, 2011 at 16:15 Comment(15)
What kind of page are you trying to goto?Matildematin
@anirudh: Just a basic php page that's stored in C:/wamp/www/ Every single page in my www/ folder gives me a 403 Forbidden when I try to access it via localhost/Vanadous
Is there an .htaccess file in the directory?Marelya
Are there other files that exist in the same directory? If so, can you access them? If not, move this file to a directory that you know are able to access files in. Can you access it there?Marelya
looks like a misconfiguration of your apache httpd.conf. Are you able to display the default <?phpinfo> test page?Matildematin
Did you examine the error_log to check what apache had to say about this error? Give us something to work with here.Ru
@s992: I can GET to the files and edit them just fine, just can't access them through the WAMP localhost server.Vanadous
@anirudh: I can't even display that. Still a 403 Forbidden. @Jahufar: No errors appear in the Apache error log at the time that I get the 403 Forbidden errors.Vanadous
why no one asking How you try to acces the page??Hurds
@Tory by "access" I meant access them via a web browser i.e. localhost/path/to/file.phpMarelya
@s992: That wouldn't work. It would simply display the contents of the php file. If it want it to be interpreted properly and display as a php should, it needs to be in my wamp/www folder.Vanadous
@Tory I am aware of this. I was under the assumption that you have multiple subfolders in your /wamp/www/ folder. If you do, you can move your PHP file to a subfolder(/wamp/www/trying_to_help_you/) and then access it via localhost/trying_to_help_you/file.php. By finding out if this works or not, we can determine whether the issue is with a specific directory config or with your apache settings as a whole.Marelya
@s992: Ah, I misunderstood. I've tried moving the files elsewhere in www/ and it seems that every thing in www/ and all the subdirectories are forbidden.Vanadous
You most likely have deny from all on your <Directory C:/wamp/www> directive. Changing that to allow from all or allow from 127.0.0.1 should fix the issue. I've submitted an answer as well.Marelya
@s992: replied to your answer. Checked that, reads allow from all.Vanadous
M
38

In httpd.conf, find the following sections and ensure they are correct:

DocumentRoot "C:/wamp/www"

<Directory />
    Options None
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

<Directory C:/wamp/www>
    Options None
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

Those are the settings that I am using in my install and they work fine. Make sure you restart Apache if you make any changes.

If you continue having issues, please update your original question with your httpd.conf.


Edit:

This is kludgey and I'm just grasping at straws here, but try adding a new entry to your vhosts:

<VirtualHost *:80>
    DocumentRoot "C:/wamp/www"
    ServerName localhost
</VirtualHost>
Marelya answered 9/6, 2011 at 17:16 Comment(9)
Still a 403. My httpd.conf is linked to via mediafire in my OP.Vanadous
I dropped your exact httpd.conf into my install and had no issues with it. Can you post your httpd-vhosts.conf? Try putting it up on pastebin.com instead of MediaFire.Marelya
@s992: Here ya go. pastebin.com/raw.php?i=j0nYBA4Q BTW, just re-installed WAMP... still a 403.Vanadous
vhosts file looks fine. Edited my answer for another thing to try. Make sure you are restarting Apache after each change.Marelya
Glad that worked..I have no idea why, but for some reason I seem to remember fixing a similar problem by doing it.Marelya
Just hit this problem myself, so as a footnote to this, I installed the 64bit version of wamp and the 32 bit version on separate machines. The 32 bit version was hitting this problem but 64 bit was fine. It seems the default settings on the 64 bit version are: 'Order Allow,Deny' 'Allow from all' but the 32 bit had these as the default: 'Order Deny,Allow' 'Deny from all' 'Allow from 127.0.0.1' Copying the 64bit settings to the 32bit one worked for me.Photodynamics
@S992 That fixed it. Amazing. I wasted 2 hours trying to figure it out. All I had to do was restart it after I made any changes to the conf files. Godlike!Antihelix
That's worked for me, this problem occurred to me when I upgraded to windows 8. ThanksPhung
I was accessing API (hosted in wampp server) through mobile device and I was getting the Authentication failure error.. but this solutions worked.. :) upvotedEntrain
C
11

It can be an ipv6 issue. So in your httpd.conf add your ipv6 local address:

Change:

Allow from 127.0.0.1

to:

Allow from 127.0.0.1
Allow from ::1:
Click answered 29/3, 2012 at 10:3 Comment(1)
You'd hit the bottom of problem. It occurs at Win8. Win8 seems to uses IPv6 by default and WAMP configuration is set for IPv4 by default. So it makes the conflict.Panel
M
6

Try changing the line in httpd.conf

Allow from 127.0.0.1 

or

 Allow from all

Refer to the documentation

Matildematin answered 9/6, 2011 at 16:49 Comment(7)
Any line in my httpd.conf that has any "allow" statement is "Allow from all".Vanadous
I hate to sound obtuse, but when you change httpd.conf, you are restarting Apache to let the changes take place, correct @Tory Waterman?Salpiglossis
@Matty: Definitely a mistake that happens more often than it should, but unfortunately not in this case. @anirudh: Well, if I did that, how would I know which instance of WAMP I'm running? Wouldn't any address with localhost/ be ambiguous with the other copy?Vanadous
That should work, because the php test script, works perfectly on a fresh install of WAMP.Matildematin
@anirudh: Re-installed. still 403.Vanadous
Did you try putting the page you are trying to access in a different directory... (shot in the dark... :D)Matildematin
@anirudh: yeah, i did. it seems everything including the sub-directories of www/ are ALL blocked.Vanadous
D
3

Marco Tamanti solution worked for me:

Allow from 127.0.0.1
Allow from ::1:

so I have:

<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>
Dinadinah answered 8/5, 2012 at 14:57 Comment(1)
You'd hit the bottom of problem. It occurs at Win8. Win8 seems to uses IPv6 by default and WAMP configuration is set for IPv4 by default. So it makes the conflict.Panel
R
2

Your "Deny From All" is what's causing the 403 error. The setup you post is used to prevent all traffic, with the intention of later allowing specific traffic. If you never allow specific traffic, you'll never get it to work.

With your 404 error, ensure you're using the right path and there's no errors in your apache error log.

http://httpd.apache.org/docs/current/mod/core.html#directory

Rothstein answered 9/6, 2011 at 16:50 Comment(1)
I don't understand what I specifically need to have where in my httpd.conf. I've tried a ton of different variations, like the one in the link you mentioned, and still nothing.Vanadous
S
1

you require 3 steps please ensure these 3 things

1.

first of all Port 80 and 443 must be allow for both TCP and UDP packets. To do this, create 2 inbound rules for TPC and UDP on Windows Firewall for port 80 and 443. (or you can disable your whole firewall for testing but permanent solution if allow inbound rule)

2.

If you are using WAMPServer 3 See bottom of answer

For WAMPServer versions <= 2.5

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
    Order Allow,Deny
      Allow from all

if "Allow from all" line not work for your then use "Require all granted" then it will work for you.

WAMPServer 3 has a different method

In version 3 and > of WAMPServer there is a Virtual Hosts pre defined for localhost so 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.

3. Dont forget to restart All Services of Wamp or Apache after making this change

Seductive answered 21/12, 2016 at 14:5 Comment(0)
I
0

Simple solutions. Just Run as Administrator the Wamp Installations file and they will works like a charm :)

Ideologist answered 20/9, 2012 at 4:36 Comment(2)
Good afternoon Elmizan - if a question is asked by a user with an established reputation, it might be more appropriate to comment with this type of suggestion (unless your very confident it is the solution) rather than submit it as an answer :)Bodily
@Bodily -- The post doesn't have the reputation to leave comments yet. However, since the question did have an accepted answer, I would call an additional attempt out of place.Pneumatometer
P
0

What I found worked for me after starting WAMP was, left clicking the WAMP icon that appears on the Taskbar, then clicking Start All Services under the Quick Admin. I was then able to access localhost using IE. I even went back to the httpd.config file and set it back to it's defaults.

Hope this helps.

Pound answered 28/2, 2014 at 17:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.