Windows 7 上的 WAMP 403 禁止消息
我已经在我的 Windows 7 机器上安装了 WAMP 2.1 版。当我在浏览器中浏览到 localhost 时,可以看到 WAMP 服务器页面。
但是当我在浏览器中浏览我的 IP 时,我收到消息
403 Forbidden:您无权访问此服务器上的 /。
有什么建议吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(26)
禁止从
httpd.conf
(Apache 的配置文件)中的127.0.0.1
以外的地址访问您的 Apache 服务器:您的 PHPMyAdmin 访问、配置文件也是如此是
phpmyadmin.conf
:您可以将它们设置为允许来自所有 IP 地址的连接,如下所示:
The access to your Apache server is forbidden from addresses other than
127.0.0.1
inhttpd.conf
(Apache's config file) :The same goes for your PHPMyAdmin access, the config file is
phpmyadmin.conf
:You can set them to allow connections from all IP addresses like follows :
我发现了一个更简单的修复...
虽然图标是绿色的 WAMP 仍然需要“放置在线”(左键单击图标时菜单的最后一项)。
之后我就可以正常访问了。
I found a simpler fix...
Although the icon was green WAMP still needs to be "Put Online" (last item of menu when left-clicking icon).
After that I had access as normal.
对我来说,包含“Require local”有助于解决错误 403。别名配置文件如下所示:
For me the inclusion of "Require local" helped to solve Error 403. The alias config file looks like this:
如果您同意从外部提供对 WAMP 服务器的访问,则更改 httpd.conf 中的权限的解决方案将起作用。
如果您不想这样做,那么您所要做的就是告诉 Windows“localhost”域指向 127.0.0.1。您可以通过编辑系统目录中的主机文件来做到这一点。
默认情况下,该文件位于 C:\Windows\System32\drivers\etc\hosts
Windows 7 附带:
您必须取消注释 localhost 的映射:
注意:您将无法编辑主机文件只读文件。要编辑,您必须是管理员,将文件复制到其他位置,编辑它,然后将其复制回 etc 目录。
我不建议更改hosts文件。使用httpd.conf文件的权限。仅当您不希望从外部访问服务器时才使用主机文件方法。
The solution for changing the permissions in the httpd.conf will work if you are OK with providing access to the WAMP server from outside.
If you do not want to do that then all you have to do is tell windows that the "localhost" domain points to 127.0.0.1. You can do that by editing the hosts file in your system directory.
The file is placed at : C:\Windows\System32\drivers\etc\hosts
by default windows 7 ships with :
You have to un-comment the mapping for localhost:
Note: you will not be able to edit the hosts file as its a read-only file. To edit, you have to be the administrator, copy the file to some other location, edit it and then copy it back to the etc directory.
I do not recommend the change of the hosts file. Use the permissions of httpd.conf file. use the hosts file approach only if you do not want the server accessed from outside.
尝试将以下代码行添加到文件 httpd-vhosts.conf 中:
Try adding the following lines of code to the file httpd-vhosts.conf:
对于 Wamp 3.1.3 和 Apache 2.4,我只需更改 httpd-vhosts.conf 文件中的 1 行。
然后我就可以从其他计算机访问我的 apache 服务器。
注明此视频来源:https://www.youtube.com/watch?v=Sy_f6wBGnjI
For Wamp 3.1.3 and Apache 2.4 I simply had to change 1 line in my httpd-vhosts.conf file.
I was then able to get to my apache server from other computers.
Give credit to this video: https://www.youtube.com/watch?v=Sy_f6wBGnjI
我发现的另一件事是,如果您的网络适配器使用 IPV6,它不会显示为 127.0.0.1 而是 ::1
我最终做的是这样的:
您的 PHPMyAdmin 访问也是如此,配置文件是 phpmyadmin.conf :
Another thing I found out is that if your network adapter uses IPV6, it will not show as 127.0.0.1 but ::1
What I ended up doing is this:
The same goes for your PHPMyAdmin access, the config file is phpmyadmin.conf :
请记住删除
httpd-vhosts.conf
中的虚拟元素Remember to remove dummy elements in
httpd-vhosts.conf
如果您使用过 localhost/phpmyadmin/
只需使用
或者如果您使用了 localhost:8080/phpmyadmin/ 那么
if you have used localhost/phpmyadmin/
simply use
or if you have used localhost:8080/phpmyadmin/ then
对于 Apache 版本 2.4.x 只需将
需要本地
替换为需要所有授权
code> 位于
标记内的 httpd.conf 文件中,然后 < strong>重新启动所有服务For Apache version 2.4.x simply replace
Require local
withRequire all granted
in httpd.conf file inside<Directory "c:/wamp/www/">
tag then Restart all services导致此问题的原因可能有很多,
我遇到过的情况是:
1)
127.0.0.1 localhost
条目在主机文件中重复2) Apache
mod_rewrite
未启用无论什么原因,备份您的
www
文件夹、vhost 配置文件(和 httpd 配置文件)都会有所帮助。这个过程需要几分钟。
祝你好运
There could many causes to this problems
What I have experienced are:
1)
127.0.0.1 localhost
entry was duplicated in hosts file2) Apache
mod_rewrite
was not enabledRegardless of the cause, backing up your
www
folder, vhost configuration file (and httpd configuration file) will help.And such process takes a few minutes.
Good luck
我读了&尝试了所有修复,但没有一个有效。最后我发现Wamp服务器标志是绿色的但需要“PUT ONLINE”。
如此简单&检查您的
PHPMyAdmin.Cofg
后快速修复HttPD.cofg
只需点击“PUT ONLINE”I read & tried All Fixes But Not one worked. At last i Found that the Wamp Server Logo Is Green But Need to Be "PUT ONLINE".
So simple & a Quick Fix After Checking Your
PHPMyAdmin.Cofg
&HttPD.cofg
Just Click on PUT ONLINE我尝试了上面的配置,只有这个适用于我的 WAMP Apache 2.4.2 配置。对于 Windows 主机文件中没有命名域的多个根站点,请使用 http://locahost:8080、http://localhost:8081、http://localhost:8082 和以下配置:
I tried the configs above and only this worked for my WAMP Apache 2.4.2 config. For multiple root site without named domains in your Windows hosts file, use
http://locahost:8080, http://localhost:8081, http://localhost:8082
and this configuration:我在 Windows 7 上使用 wamp 时遇到了这个问题。将以下代码添加到 httpd-vhosts.conf 解决了我的问题。
I faced this issue with wamp on windows 7. Adding following code to httpd-vhosts.conf solved the issue for me.
谢谢你的提问。
我现在用的是wamp 3。
我在你的问题下找到了一个简单的答案。
但这个答案在 wamp 3 上应该会有所改变。
步骤如下:
Thanks for your question.
I'am using wamp 3 now.
And I find an simple answer to do this under your question.
But that answer should change a little on wamp 3.
The steps are as following:
我花了很长时间才弄清楚这一点。
C:\wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf
在此文件中,您会注意到几个示例虚拟主机文件,如下所示:
只需删除这些条目并替换为:
您绝对需要确保你的其他鸭子排成一排,但这对我来说是有效的解决方案。
It took me forever to figure this out.
C:\wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf
In this file you will notice several example virtual host files, that look like:
Simply delete these entries and replace with:
You definitely need to make sure your other ducks are in a row but this for me with the solution that worked.
您好,有 2 个解决方案:
在文本文件 (httpd.conf) 中将端口 80 更改为 81
然后单击 127.0.0.1:81
更改网络设置
进入控制面板--网络和互联网--网络和共享中心
点击-->本地连接
选择-->属性
检查 true 中的 -allow other .....
以及 --- 其他......
hi there are 2 solutions :
change the port 80 to 81 in the text file (httpd.conf)
and click 127.0.0.1:81
change setting the network
go to control panel--network and internet--network and sharing center
click-->local area connection
select-->propertis
check true in the -allow other .....
and --- allo other .....
我也有这个问题。我的问题的根源是我在 vhosts.conf 文件中犯了一个错误。如果您使用虚拟主机,这是另一件事要检查
I had this problem too. The route of my problem was I had made a mistake in my vhosts.conf file. If you are using vhosts this is another thing to check
httpd.conf 中的此配置对我来说效果很好。
This configuration in httpd.conf work fine for me.
确保您在 .conf 文件的路径名中没有使用 Windows 目录分隔符(反斜杠),即使您使用的是 Windows。 Apache 无法理解它们,但仍会启动并输出
403 Forbidden Message
。错误:
正确:
Make sure you aren't using a Windows' directory separator character (backslash) in your path names in your .conf file, even if you are on Windows. Apache doesn't understand them but will still start up and then output a
403 Forbidden Message
.wrong:
right:
令人惊讶的是,DocumentRoot(以及相关的,如)路径中的方括号也会导致错误 403:
DocumentRoot "P:/TRY/web/fatfree/from_github/fatfree-master[bang]"
失败并显示 403,而DocumentRoot "P:/TRY/web/fatfree/from_github/fatfree-master"
工作正常。(我没有费心去弄清楚 Apache 路径转义,如果有的话,只是重命名了路径。如果有人知道,欢迎评论。)
Surprisingly, square brackets in DocumentRoot (and related, like <Directory>) paths can also cause error 403:
DocumentRoot "P:/TRY/web/fatfree/from_github/fatfree-master[bang]"
failed with 403, whileDocumentRoot "P:/TRY/web/fatfree/from_github/fatfree-master"
worked fine.(I didn't bother figuring out the Apache path escaping, if any, just renamed the path instead. If anyone knows, comments are welcome.)
我的解决方案是禁用编码文件的编码(这些文件在 Windows 中为绿色)。我从 MAC 计算机上获取了这些文件,默认情况下它是加密的。
我已经选择了这些文件>右键单击>属性>常规选项卡>和高级>取消选中加密文件...
瞧,它可以工作了。
My solution was to disable encoding for encoded files (these files are green in windows). Ive got these files from MAC computer and it was encrypted by default.
Ive select these files > right click > properities > general tab > andvanced > uncheck encrypt files...
And voila it works.
除了清除 .htaccess 文件中的混乱之外,我已经尝试了所有的方法。
转到 www/ 目录并在另一个文件夹中复制 .htaccess 文件。然后清除.htaccess原始文件中的所有行。
并添加此行,
RewriteEngine On
然后重新启动服务器。
这解决了我的问题并可以访问我的所有本地主机站点。
希望它也能解决你的问题。
I have tried all the stuff except clearing the mess in .htaccess file.
Go to www/ directory and make a copy of .htaccess file in another folder. Then clear all the lines in .htaccess original file.
And add this line,
RewriteEngine On
Then restart the server.
This has solved my problem and got access to all my localhost sites.
Hope it would solve yours too.
另外,在 Apache 2,4 上,您可能需要将其添加到 conf 中的目录指令中,
如果您决定包含 httpd-vhosts.conf。
默认情况下,您可以将 wamp 安装在 C:\ 但仍选择将 Web 开发部署在其他位置。
要在 vhosts.conf 中执行此操作,您可以添加以下指令:
Also on Apache 2,4 you may need to add this to the directory directive in conf,
in case you decided to include httpd-vhosts.conf.
By default you can install wamp in C:\ but still choose to deploy your web development in another location.
To do this inside the vhosts.conf you can add this directive:
确保目录
c:/wamp/apps/phpmyadmin3.1.3.1/
中的文件名与 phpMyAdmin.conf 中的名称(或版本)匹配(别名/phpmyadmin "c:/wamp/apps/phpmyadmin3.1.3.1/"
)make sure that, the name of the file in the directory
c:/wamp/apps/phpmyadmin3.1.3.1/
, match the name (or version) in the phpMyAdmin.conf (Alias /phpmyadmin "c:/wamp/apps/phpmyadmin3.1.3.1/"
)我发现,如果您使用 ammps,出于某种原因,当它位于您的根文件夹中时,它总是被禁止,因此我将其放在根文件夹上方的目录中,并使用以下命令在
httpd.conf
中创建了一个别名这个Alias /phpmyadmin "C:/Program Files (x86)/Ampps/phpMyAdmin"
请注意,我正在使用 ammps,我不确定它是否适用于其他人,但值得一试;)
I have found that if you are using ammps that for some reason its always forbidden when its in your root folder so i put it in the directory above my root folder and made a alias in the
httpd.conf
using thisAlias /phpmyadmin "C:/Program Files (x86)/Ampps/phpMyAdmin"
please note i am using ammps and i dont know for sure if it will work for others but its worth a try ;)