所有通过 WAMP 的本地主机页面都被阻止了吗?

发布于 2024-11-14 20:48:37 字数 297 浏览 4 评论 0原文

当我尝试通过本地主机上的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

り繁华旳梦境 2024-11-21 20:48:37

在 httpd.conf 中,找到以下部分并确保它们正确:

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>

这些是我在安装中使用的设置,它们工作正常。如果进行任何更改,请确保重新启动 Apache。

如果您仍然遇到问题,请使用您的 httpd.conf 更新您的原始问题。


编辑:

这很糟糕,我只是在这里抓住救命稻草,但尝试向您的虚拟主机添加一个新条目:

<VirtualHost *:80>
    DocumentRoot "C:/wamp/www"
    ServerName localhost
</VirtualHost>

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>
终陌 2024-11-21 20:48:37

这可能是 ipv6 问题。因此,在您的 httpd.conf 中添加您的 ipv6 本地地址:

将:更改

Allow from 127.0.0.1

为:

Allow from 127.0.0.1
Allow from ::1:

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:
清醇 2024-11-21 20:48:37

尝试更改 httpd.conf 中的行

Allow from 127.0.0.1 

 Allow from all

参阅文档

Try changing the line in httpd.conf

Allow from 127.0.0.1 

or

 Allow from all

Refer to the documentation

南渊 2024-11-21 20:48:37

Marco Tamanti 解决方案对我有用:

Allow from 127.0.0.1
Allow from ::1:

所以我有:

<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>

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>
情徒 2024-11-21 20:48:37

您的“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

是伱的 2024-11-21 20:48:37

确保以下三件事

1.

您需要 3 个步骤,请首先
端口 80 和 443 必须允许 TCP 和 UDP 数据包。为此,请在 Windows 防火墙上为端口 80 和 443 创建 2 个 TPC 和 UDP 入站规则。
(或者您可以禁用整个防火墙进行测试,但如果允许入站规则,则可以永久解决)

2.

如果您使用的是 WAMPServer 3 请参阅答案底部

对于 WAMPServer 版本 <= 2.5

您需要更改安全性将 Apache 设置为允许从其他任何地方访问,因此请编辑您的 httpd.conf 文件。

将此部分从:更改

#   onlineoffline tag - don't remove
     Order Deny,Allow
     Deny from all
     Allow from 127.0.0.1
     Allow from ::1
     Allow from localhost

为:

#   onlineoffline tag - don't remove
    Order Allow,Deny
      Allow from all

如果“允许所有”行不适用于您,则使用“要求所有已授予”
那么它就会为你工作。

WAMPServer 3 有不同的方法

在版本 3 和 > 中WAMPServer 有一个为 localhost 预定义的虚拟主机,因此根本不要修改 httpd.conf 文件,保留您发现的样子。

使用菜单编辑 httpd-vhosts.conf 文件。

输入图片此处的描述

它应该如下所示:

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot D:/wamp/www
    <Directory  "D:/wamp/www/">
        Options +Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

将其修改为

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot D:/wamp/www
    <Directory  "D:/wamp/www/">
        Options +Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

希望您已为您的项目创建了虚拟主机,并且没有为您的站点使用 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 :

#   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

迟到的我 2024-11-21 20:48:37

简单的解决方案。只需以管理员身份运行 Wamp 安装文件,它们就会像魅力一样工作:)

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

酒废 2024-11-21 20:48:37

我发现启动 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文