设为首页 收藏本站
查看: 535|回复: 0

[经验分享] apache http 403 Forbidden error解决办法

[复制链接]

尚未签到

发表于 2017-1-6 11:15:06 | 显示全部楼层 |阅读模式
  
 
在配置Linux的 Apache服务时,经常会遇到http403错误,我今天配置测试时也出现了,最后解决了,总结了一下。http 403错误是拒绝访问的意思,有很多原因的。我总结的主要有4种原因!
1. 访问的文档权限不够。要755以上权限。解决方法:用命令chmod 755 /var/www/ 或其他相应目录。
2. SELinux或防火墙的原因。解决方法:先关闭SELinux和让防火墙通过WWW服务。
3. 虚拟主机配置错误。解决方法:重新配置虚拟主机或暂时关闭。
4. alias指令配置错误。(alias语法:Alias URL-path file-path|directory-path)
   解决方法如下: 打开apache的配置文件httpd.conf,查看所有的alias指令,若指令中的URL-path末尾包含/,则file-path或dir-path的末尾也需要包含/,如下所示:
alias/server1  /var/server1//正确
alias/server1//var/server1///正确
alias/server1//var/server1//错误
5. DocumentRoot的设置。解决方法如下:
打开 apache的配置文件httpd.conf,找到这段代码:
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>

有时候由于配置了php后,这里的“Deny from all”已经拒绝了一切连接。把该行改成“allow from all”,修改后的代码如下,问题解决。
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>

6. For bugzilla installation
You should check the user in httpd.conf and localconfig, and make sure the same user in those two files:
6.1 For httpd.conf as below:
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User daemon
Group daemon

6.2 For localconfig
# This is the group your web server runs as.
# If you have a Windows box, ignore this setting.
# If you do not have access to the group your web server runs under,
# set this to "". If you do set this to "", then your Bugzilla installation
# will be _VERY_ insecure, because some files will be world readable/writable,
# and so anyone who can get local access to your machine can do whatever they
# want. You should only have this set to "" if this is a testing installation
# and you cannot set this up any other way. YOU HAVE BEEN WARNED!
# If you set this to anything other than "", you will need to run checksetup.pl
# asroot, or as a user who is a member of the specified group.
$webservergroup = 'daemon';

 
6.3 Change the ownership by the chown command as below:
Chown -R root:daemon bugs/
 

转载自:http://www.cnblogs.com/allenblogs/archive/2010/08/16/1800456.html

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-324657-1-1.html 上篇帖子: 使用Capistrano部署apache+mongrel cluster 下篇帖子: Java组合模式-apache commons-io
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表