apache http 403 Forbidden error

在配置Linux的 Apache服务时,经常会遇到http403错误,我今天配置测试时也出现了,最后解决了,总结了一下。http 403错误是拒绝访问的意思,有很多原因的。我总结的主要有4种原因!

1. 访问的文档权限不够。要755以上权限。解决方法:用命令chmod 755 /var/www/ 或其他相应目录。

2. SELinux或防火墙的原因。解决方法:先关闭SELinux和让防火墙通过WWW服务。

3. 虚拟主机配置错误。解决方法:重新配置虚拟主机或暂时关闭。

4. 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>

5. For bugzilla installation

You should check the user in httpd.conf and localconfig, and make sure the same user in those two files:

5.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

5.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';

 

5.3 Change the ownership by the chown command as below:

Chown -R root:daemon bugs/

 

转载于:https://www.cnblogs.com/allenblogs/archive/2010/08/16/1800456.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值