简体   繁体   English

127.0.0.1在WAMP服务器上不起作用

[英]127.0.0.1 not working on wamp server

I have installed WAMP in my system and http://localhost is working nicely. 我已经在系统中安装了WAMP,并且http://localhost运行良好。

but when i got 127.0.0.1 then it gives Forbidden error: 但是当我得到127.0.0.1时,它给出了禁止错误:

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: 在httpd.config中,我具有允许所有权限的权限:

<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 任何建议将不胜感激。

The correct syntax for Apache 2.4.x is Apache 2.4.x的正确语法是

<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 现在,如果您实际上不希望在将网站开发到整个Internet时授予其访问权限,则更好的方法是

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

The require local covers localhost, 127.0.0.1 and ::1. require本地覆盖localhost,127.0.0.1和:: 1。 ::1 is the IPV6 equivalent of 127.0.0.1 :: 1是IPV6的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 如果您希望能够从本地网络上的其他PC访问WAMPServer(Apache),则也可以添加此行

<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. 注意:我只使用了普通4分位数集的前3个四分位数,因此可以访问内部子网中的任何IP。

You will have to check what your actual subnet is as 192.168.0.x is a default but not for all home routers. 您将必须检查实际的子网是什么,因为192.168.0.x是默认设置,但不是所有家用路由器都可以。

Can i suggest you read this document and make the required fixes for the WAMPServer 2.4 release. 我可以建议您阅读本文档并为WAMPServer 2.4版本进行必要的修复。 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! 逐一进行每个更改,并确保每次更改后都重新启动Apache和MySQL,这样您就可以知道发生错误的位置,而不是一go而就!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM