您的位置首页百科问答

Permission denied: access to /kk01/ denied

Permission denied: access to /kk01/ denied

的有关信息介绍如下:

Permission denied: access to /kk01/ denied

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.

#

Options FollowSymLinks

AllowOverride None

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

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

查看/etc/http/conf/httpd.conf中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

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

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

修改

SELINUX=enforcing

改成

SELINUX=disabled

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

6:最终定位问题并解决

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