添加 VirtualHost 失败:访问禁止错误 403 (XAMPP) (Windows 7)
我在 Windows 7 上运行了 XAMPP 安装。
一旦我将 VirtualHost 添加到 httpd-vhosts.conf,“常规”http://localhost
和新的 dropbox .local
不起作用。
这是我添加到我的 httpd-vhosts.conf
中的内容:
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "E:/Documenten/Dropbox/Dropbox/dummy-htdocs"
ServerName dropbox.local
ServerAlias www.dropbox.local
ErrorLog "logs/dropbox.local-error.log"
CustomLog "logs/dropbox.local-access.log" combined
</VirtualHost>
所以我查找了我的 dropbox.local-error.log
以获取任何信息:
[Thu Feb 02 10:41:57 2012] [error] [client 127.0.0.1] client denied by server configuration: E:/Documenten/Dropbox/Dropbox/dummy-htdocs/
此错误似乎可以通过以下方式解决 :添加
<directory "E:/Documenten/Dropbox/Dropbox/dummy-htdocs">
Allow from all
</directory>
但现在我在 dropbox.local-error.log
中收到此错误:
[Thu Feb 02 10:45:56 2012] [error] [client ::1] Directory index forbidden by Options directive: E:/Documenten/Dropbox/Dropbox/dummy-htdocs/
此外,当我尝试访问 http://localhost
时,我在常规中没有收到任何错误error.log
,虽然我得到了当我尝试访问它时出现错误403
。
任何人都可以帮忙吗...这让我发疯:S
编辑:
另外在 httpd.conf
中有以下内容(我已经多次看到它被提及,所以在有人说它之前):
<IfModule dir_module>
DirectoryIndex index.php index.pl index.cgi index.asp index.shtml index.html index.htm \
default.php default.pl default.cgi default.asp default.shtml default.html default.htm \
home.php home.pl home.cgi home.asp home.shtml home.html home.htm
</IfModule>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
好的:这就是我现在所做的,它已经解决了:
我的
httpd-vhosts.conf
现在看起来像这样:首先,我发现有必要设置
;
选项。所以我把; [..]
- 内的部分[..]
。之后,我将
AllowOverride AuthConfig Indexes
添加到
选项中。现在,http://localhost 也指向 dropbox-virtualhost。因此,我将
dropbox.local
添加到
中,使其成为最终它有效:D!
我是一个快乐的人! :) :)
我希望其他人可以使用此信息。
Okay: This is what I did now and it's solved:
My
httpd-vhosts.conf
looks like this now:First, I saw that it's necessary to have set the
<Directory xx:xx>
options. So I put the<Directory > [..] </Directory>
-part INSIDE the<VirtualHost > [..] </VirtualHost>
.After that, I added
AllowOverride AuthConfig Indexes
to the<Directory>
options.Now
http://localhost
also points to the dropbox-virtualhost. So I addeddropbox.local
to<VirtualHost *:80>
which makes it as<VirtualHost dropbox.local:80>
FINALLY it works :D!
I'm a happy man! :) :)
I hope someone else can use this information.
对我来说,当我将“目录”内容更改为:
For me worked when I changed "directory" content into this:
对于我(以及 Windows 7 上的 XAMPP)来说,这就是有效的:
正是这一行会导致 403:
For me (also XAMPP on Windows 7), this is what worked:
It is this line that would cause the 403:
我在 Windows 7 上使用 XAMPP 1.6.7。 这篇文章对我有用。
我在
C:/xampp/apache/conf/extra
的httpd-vhosts.conf
文件中添加了以下几行。我还取消了注释行
# NameVirtualHost *:80
重新启动 apache 后,它仍然无法工作。
然后我必须按照文章中提到的步骤 9 编辑文件
C:/Windows/System32/drivers/etc/hosts
。然后我开始工作
http://mysite.dev
I'm using XAMPP 1.6.7 on Windows 7. This article worked for me.
I added the following lines in the file
httpd-vhosts.conf
atC:/xampp/apache/conf/extra
.I had also uncommented the line
# NameVirtualHost *:80
After restarting the apache, it were still not working.
Then I had to follow the step 9 mentioned in the article by editing the file
C:/Windows/System32/drivers/etc/hosts
.Then I got working
http://mysite.dev
谢谢你,成功了!但我
用那个
替换了这个否则,.htaccess 不起作用:我遇到了 RewriteEngine 问题和错误消息“此处不允许 RewriteEngine”。
Thank you, that worked! But I replaced this
with that
Otherwise, the .htaccess didn't work: I got problems with the RewriteEngine and the error message "RewriteEngine not allowed here".
以上建议对我不起作用。我让它在我的 Windows 上运行,灵感来自
http://butlerccwebdev.net/support/testingserver/vhosts-setup-win.html
对于httpd-vhosts.conf中的Http
对于在httpd-ssl.conf中使用Https(开放SSL)
希望它可以帮助别人!
Above suggestions didn't worked for me. I got it running on my windows, using inspiration from
http://butlerccwebdev.net/support/testingserver/vhosts-setup-win.html
For Http inside httpd-vhosts.conf
For using Https (Open SSL) inside httpd-ssl.conf
Hope it helps someone !!
经过这么多的改变、尝试和答案。
为了
不要编辑其他文件,例如 httpd-xampp
停止 Apache
打开位于
**your_xampp_directory**\apache\conf\extra\
的 httpd-vhosts.conf (默认情况下,您的 XAMPP 目录可能是:C:/xampp/htdocs
)删除以下行之前的哈希值(大约第 20 行):
NameVirtualHost *:80
(这可能是可选的)考虑到您的目录路径,在文件末尾添加以下虚拟主机:
<前><代码>##127.0.0.1
<虚拟主机 *:80>
文档根目录“C:/xampp/htdocs”
服务器名称 localhost
错误日志“logs/localhost-error.log”
CustomLog“logs/localhost-access.log”常见
##127.0.0.2
<虚拟主机 *:80>
文档根目录“F:/myapp/htdocs/”
服务器名称 test1.localhost
服务器别名 www.test1.localhost
错误日志“logs/myapp-error.log”
CustomLog“logs/myapp-access.log”常见
<目录“F:/myapp/htdocs/”>
#全部选项 # 已弃用
#AllowOverride All # 已弃用
要求全部授予
编辑(具有管理员访问权限)您的主机文件(位于
Windows\System32\drivers\etc< /code>,但使用以下提示,每个域只有一个环回 IP:
<前><代码>127.0.0.1 本地主机
127.0.0.2 test1.localhost
127.0.0.2 www.test1.localhost
对于每个实例,重复第二个块,第一个块是仅用于“默认”目的的主块。
After so many changes and tries and answers.
For
Do not edit other files like httpd-xampp
Stop Apache
Open httpd-vhosts.conf located in
**your_xampp_directory**\apache\conf\extra\
(your XAMPP directory might be by default:C:/xampp/htdocs
)Remove hash before the following line (aprox. line 20):
NameVirtualHost *:80
(this might be optional)Add the following virtual hosts at the end of the file, considering your directories paths:
Edit (with admin access) your host file (located at
Windows\System32\drivers\etc
, but with the following tip, only one loopback ip for every domain:For every instance, repeat the second block, the first one is the main block only for "default" purposes.
我正在使用 xampp 1.7.3。使用这里的灵感:xampp 1.7.3 升级损坏的虚拟禁止主机访问
代替添加
; .. httpd-vhosts.conf 中的
,我将其添加到httpd.conf 中/xampplite/cgi-bin"> ..
。这是我在 httpd.conf 中添加的内容:
这是我在 httpd-vhosts.conf 中添加的内容
我还在 httpd.conf 中添加了
Listen 8001
来完成我的设置。希望有帮助
I am using xampp 1.7.3. Using inspiration from here: xampp 1.7.3 upgrade broken virtual hosts access forbidden
INSTEAD OF add
<Directory> .. </Directory>
in httpd-vhosts.conf, I add it in httpd.conf right after<Directory "D:/xampplite/cgi-bin"> .. </Directory>
.Here is what I add in httpd.conf:
And here is what I add in httpd-vhosts.conf
I also add
Listen 8001
in httpd.conf to complete my setting.Hope it helps
对于许多人来说,这是一个权限问题,但对我来说,事实证明该错误是由我尝试提交的表单中的错误引起的。具体来说,我不小心在“action”值后面加上了“大于”符号。所以我建议你再看一下你的代码。
For many it's a permission issue, but for me it turns out the error was brought about by a mistake in the form I was trying to submit. To be specific i had accidentally put a "greater than" sign after the value of "action". So I would suggest you take a second look at your code.