Mos*_*oss 11 wamp virtualhost wampserver http-status-code-403
当我尝试在c:/ wamp/www /目录之外创建一个虚拟主机时,Wampserver告诉我被拒绝.我可以在该目录中做一个罚款.即使创建一个文件夹的符号链接,但我宁愿不必使用符号链接.为什么不起作用?
这是我在httpd.conf末尾使用的代码
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "c:/wamp/www"
ServerName localhost
ServerAlias localhost
</VirtualHost>
<VirtualHost *:80>
ServerName local.cascade
DocumentRoot c:/wamp/www/cascade/
</VirtualHost>
<VirtualHost *:80>
ServerName local.md9
ServerAlias local.md9
DocumentRoot "m:/Work/New MD9.ca/site/"
</VirtualHost>
<Directory "m:/Work/New MD9.ca/site/">
Order Allow,Deny
Allow from All
</Directory>
Run Code Online (Sandbox Code Playgroud)
"级联"vh工作得很好.
Mos*_*oss 26
我想我应该更仔细地查看http.conf.这不是那么久,主要是评论.麻烦的是这个.
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
<Directory />
AllowOverride none
Require all denied
</Directory>
Run Code Online (Sandbox Code Playgroud)
我评论了它,现在的东西工作,虽然我猜它不太安全,但它只是一个测试服务器.
我认为这<Directory "m:/Work/New MD9.ca/site/">
应该是照顾它但我猜不是.
Dav*_*irk 18
我知道这个问题现在已经过时了,你已经有了它的工作,但是我遇到了这个问题,并在不删除Require all denied
标签的情况下解决了这个问题.
您只需要在Directory标记中添加Require local
(或Require all
用于在线访问)标记.例如
<VirtualHost *:80>
ServerName local.md9
ServerAlias local.md9
DocumentRoot "m:/Work/New MD9.ca/site/"
<Directory "m:/Work/New MD9.ca/site/">
Order Allow,Deny
Allow from All
Require local
</Directory>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
您可以在httpd.conf中的DocumentRoot目录中看到相同的规则
我遇到了同样的问题,但在看完这个问题后设法解决了.
但是,接受的答案可能不是最佳解决方案,具体取决于您希望Apache配置的安全性.
我认为解决方案应该提到两件事,首先要确保安全性不会受到损害,其次是; 了解Apache 2.2和2.4之间的访问控制配置的差异.
评论建议的行:
<Directory />
AllowOverride none
Require all denied
</Directory>
Run Code Online (Sandbox Code Playgroud)
表示您删除应用于计算机上所有目录的默认严格安全性,据我所知.其他人可以创建指向您的C:\very\sensitive\information
目录的配置,并从那里向网站提供内容(这很可能是共享主机上的一个问题).有趣的是,以下评论在该块之上:
# First, we configure the "default" to be a very restrictive set of
# features.
Run Code Online (Sandbox Code Playgroud)
然后在那个街区下面:
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
Run Code Online (Sandbox Code Playgroud)
将所有内容锁定,然后有条件地解锁每个目录是完全合理的.
我想出了以下内容,它指向我机器上的所有网站(通过Apache虚拟主机提供)的位置.这紧跟在<Directory "d:/wamp/www/"></Directory>
块之后.
<Directory "d:/wamp/sites/">
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
</Directory>
Run Code Online (Sandbox Code Playgroud)
然后,在每个虚拟主机配置/别名中,您可以设置适用于该目录的配置.
在更新版本的Apache中配置访问控制已更改.
过去是什么:
Order allow,deny
Allow from all
Run Code Online (Sandbox Code Playgroud)
现在应该是:
Require all granted
Run Code Online (Sandbox Code Playgroud)
有关更多信息:http://httpd.apache.org/docs/current/upgrading.html
归档时间: |
|
查看次数: |
21574 次 |
最近记录: |