Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
401 views
in Technique[技术] by (71.8m points)

php - 127.0.0.1 not working on wamp server

I have installed WAMP in my system and http://localhost is working nicely.

but when i got 127.0.0.1 then it gives Forbidden error:

Forbidden

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

I don't know what is this error for

in httpd.config i have give permission to allow all:

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

and if i set in my host file

127.0.0.1  localhost
127.0.0.1  test

and access test it gives same error. Any suggestion would be appreciated.thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The correct syntax for Apache 2.4.x is

<Directory "c:/wamp/www/">
    Options Indexes FollowSymLinks
    AllowOverride all
    Require all granted
</Directory>

Now if you did not actually want to give access to your site while you develop it to the whole internet a better method would be

<Directory "c:/wamp/www/">
    Options Indexes FollowSymLinks
    AllowOverride all
    Require local
</Directory>

The require local covers localhost, 127.0.0.1 and ::1. ::1 is the IPV6 equivalent of 127.0.0.1

If you want to be able to access the WAMPServer (Apache) from other PC's on your local network then you can include this line as well

<Directory "c:/wamp/www/">
    Options Indexes FollowSymLinks
    AllowOverride all
    Require local
    Require ip 192.168.0
</Directory>

Note: I used only the first 3 quartiles of the normal 4 quartile set, this gives access to any ip on your internal subnet.

You will have to check what your actual subnet is as 192.168.0.x is a default but not for all home routers.

Can i suggest you read this document and make the required fixes for the WAMPServer 2.4 release. Make each change one by one and make sure that Apache and MySQL start again after each change so you can know where you make any mistakes, as they happen, rather than doing them all in one go!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...