Apache2 403 Forbidden错误
最常见的问题就是需要访问的目录没有设置权限
只需要加一段directory的设置即可,见:
折叠复制代码
- <Directory"/opt/ysz/vip_static_file">
- AllowOverride None
- Options None
- Order allow,deny
- Allow from all
- </Directory>
今天,在部署一个应用时,发现对应的目录中有个软链接目录无法访问
报错403 Forbidden,但其它的正常的文件和目录都可以正常访问
开始尝试把软链接对应的真实目录也给加上相应的directory设置,但还是不行
后来,查看了apache2的参考手册,发现了Options的FollowSymLinks这个属性
它就是来控制允许服务器在此目录中使用符号连接,加上这个选项后,软链接目录就可以正常访问了
另外,需要注意,该软链接对应的实际目录属性应该为755以上才可以访问的
其中,Indexs属性用来控制允许显示目录下的文件列表,正常情况下,不应该加这个Indexs选项的
wamp2.5(apache2.4.9)下局域网访问403错误的解决
弄了一个下午,从百度了N条记录都没有说在点子上,实际处理起来非常简单。
先介绍一下环境:win8.1+wamp2.5(apache2.4.9)
安装路径:D:\wamp
1、在D:\wamp\bin\apache\apache2.4.9\conf目录下找到“httpd.conf”文件(建议先备份一下)
2、将“httpd.conf”下240行处的:
<Directory />
AllowOverride none
Require all denied
</Directory>
更改为
<Directory />
#Require all deniedAllowOverride none
Require all granted
</Directory>
2、将“httpd.conf”下约254行处的:
<Directory "d:/wamp/www/">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
# onlineoffline tag - don't remove
Require local</Directory>
更改为:
<Directory "d:/wamp/www/">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
# onlineoffline tag - don't remove
Require localRequire all granted
</Directory>
实际上就是在“
Require local”下面增加一条配置“
Require all granted”,保存后退出。
3、重启Wmapserver,应该就OK了。
希望能帮到有需要的朋友。
顺便推荐一下我的金融导航小站 http://www.voovooo.com,欢迎收藏,QQ就不留了,网站里有联系方式。
补充一句:我的网站路径:D:\wamp\www
~~菜鸟站长, 诸位见笑了。
按照你的方法凑效了,折腾死了。。。。