Permission denied: access to /kk01/ denied

转自:http://jingyan.baidu.com/article/54b6b9c0e0ea172d583b4725.html

Apache http启动正常。但是访问不了http共享出来的目录。页面403报错,同时http日志也报错。

问题解决步骤:

1:页面报错

2:http日志报错

3:查看Directory /  是否配置错误

4:查看Directory "/var/www/html"  是否配置错误

5:查看/etc/selinux/config文件是否配置错误

6:最终定位问题并解决

1:页面报错

输入http://172.30.x.x  出现http欢迎界面。

但是输入http:172.30.x.x/kk01 页面403报错:

Forbidden

You don't have permission to access /kk01 on this server.


2:http日志报错

[root@localhost ~]# cd /var/log/httpd/

[root@localhost httpd]# ls

access_log  error_log

[root@localhost httpd]# ll

?荤.?.20

-rw-r--r--. 1 root root 7310 11?.19 21:47 access_log

-rw-r--r--. 1 root root 8645 11?.19 21:47 error_log

[root@localhost httpd]#

[root@localhost ~]# cat /var/log/httpd/error_log

报错:Permission denied: access to /kk01/ denied


3:查看Directory /  是否配置错误

查看/etc/http/conf/httpd.conf中Directory / 配置

DocumentRoot "/var/www/html"

 

#

# Each directory to which Apache has access can be configured with respect

# to which services and features are allowed and/or disabled in that

# directory (and its subdirectories).

#

# First, we configure the "default" to be a very restrictive set of

# features.

#

<Directory />

    Options  FollowSymLinks

    AllowOverride None

</Directory>

这些都是rhel 6.5 中的httpd.conf配置文件的默认配置,可以看到配置没有问题。所以不需要修改


4:查看Directory "/var/www/html"  是否配置错误

查看/etc/http/conf/httpd.conf中Directory "/var/www/html" 配置

<Directory "/var/www/html">

 

#

# 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.2/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:

#   Options FileInfo AuthConfig Limit

#

    AllowOverride None

 

#

# Controls who can get stuff from this server.

#

    Order allow,deny

    Allow from all

 

</Directory>

这些都是rhel 6.5 中的httpd.conf配置文件的默认配置,可以看到配置没有问题。所以不需要修改



5:查看/etc/selinux/config文件是否配置错误

修改

SELINUX=enforcing

改成

SELINUX=disabled

修改完成之后,reboot重启系统


6:最终定位问题并解决

重启之后,访问正常。SELinux(Security-EnhancedLinux)是美国国家安全局(NAS)对于强制访问控制的实现.如果linux当服务器使用的话,建议关闭SELinux,来节省你的工作时间。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值