所有通过 WAMP 的本地主机页面都被阻止了吗?
当我尝试通过本地主机上的 WAMP 访问我的页面之一时,我一直在尝试修复一个奇怪的 403 Forbidden 错误。
添加一条规则以通过 apache 使用的 Windows 防火墙打开端口 80 后,我注意到这并没有解决我的问题,而是通过 localhost 为我的所有页面提供了 403 禁止。
删除我刚刚制定的规则(导致此问题开始)并不能解决问题。禁用 Windows 防火墙并不能解决此问题。重新启动我的电脑并不能解决问题。有什么想法吗?
编辑2: 我可以访问 localhost/phpmyadmin 以获得任何有价值的信息。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
在 httpd.conf 中,找到以下部分并确保它们正确:
DocumentRoot "C:/wamp/www"
这些是我在安装中使用的设置,它们工作正常。如果进行任何更改,请确保重新启动 Apache。
如果您仍然遇到问题,请使用您的 httpd.conf 更新您的原始问题。
编辑:
这很糟糕,我只是在这里抓住救命稻草,但尝试向您的虚拟主机添加一个新条目:
In httpd.conf, find the following sections and ensure they are correct:
DocumentRoot "C:/wamp/www"
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:
这可能是 ipv6 问题。因此,在您的 httpd.conf 中添加您的 ipv6 本地地址:
将:更改
为:
It can be an ipv6 issue. So in your httpd.conf add your ipv6 local address:
Change:
to:
尝试更改 httpd.conf 中的行
或
参阅文档
Try changing the line in httpd.conf
or
Refer to the documentation
Marco Tamanti 解决方案对我有用:
所以我有:
Marco Tamanti solution worked for me:
so I have:
您的“Deny From All”是导致 403 错误的原因。您发布的设置用于阻止所有流量,目的是稍后允许特定流量。如果您从不允许特定流量,您将永远无法使其正常工作。
对于 404 错误,请确保您使用正确的路径并且 apache 错误日志中没有错误。
http://httpd.apache.org/docs/current/mod/core .html#目录
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
确保以下三件事
1.
您需要 3 个步骤,请首先
端口 80 和 443 必须允许 TCP 和 UDP 数据包。为此,请在 Windows 防火墙上为端口 80 和 443 创建 2 个 TPC 和 UDP 入站规则。
(或者您可以禁用整个防火墙进行测试,但如果允许入站规则,则可以永久解决)
2.
如果您使用的是 WAMPServer 3 请参阅答案底部
对于 WAMPServer 版本 <= 2.5
您需要更改安全性将 Apache 设置为允许从其他任何地方访问,因此请编辑您的
httpd.conf
文件。将此部分从:更改
为:
如果“允许所有”行不适用于您,则使用“要求所有已授予”
那么它就会为你工作。
WAMPServer 3 有不同的方法
在版本 3 和 > 中WAMPServer 有一个为
localhost
预定义的虚拟主机,因此根本不要修改httpd.conf
文件,保留您发现的样子。使用菜单编辑
httpd-vhosts.conf
文件。它应该如下所示:
将其修改为
希望您已为您的项目创建了虚拟主机,并且没有为您的站点使用
wamp\www
文件夹。在这种情况下,请保留 localhost 定义,仅对您的虚拟主机进行更改。3.
进行此更改后,不要忘记重新启动 Wamp 或 Apache 的所有服务
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 :
To :
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 thehttpd.conf
file at all, leave it as you found it.Using the menus, edit the
httpd-vhosts.conf
file.It should look like this :
Amend it to
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
简单的解决方案。只需以管理员身份运行 Wamp 安装文件,它们就会像魅力一样工作:)
Simple solutions. Just Run as Administrator the Wamp Installations file and they will works like a charm :)
我发现启动 WAMP 后对我有用的是,左键单击任务栏上出现的 WAMP 图标,然后单击“快速管理”下的“启动所有服务”。然后我就可以使用 IE 访问 localhost。我什至返回到 httpd.config 文件并将其设置回默认值。
希望这有帮助。
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.