我在Centos6.4服务器上有一个文件夹(不是传统的/ var / www / html文件夹!)/ Server / Websites / Default。 只有一个文件,phpinfo.php(其中有明显的代码)。 在Firefox中运行http://localhost/Default/phpinfo.php ,显示正确的PHP信息页面。 当我访问http://localhost/Default/页面时,它显示了一个禁止的'你没有权限访问/在这个服务器上。 页。 我想要它列出目录内容。
在我的/etc/httpd/conf/httpd.conf文件中,(显示时间太长,所以我粘贴了一些我认为重要的关键代码):
DocumentRoot "/Server/Websites" <Directory /Server/Websites> Options +Indexes Includes FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory>
SELinux聪明,我也为# getsebool -a | grep httpd # getsebool -a | grep httpd :
allow_httpd_anon_write --> off allow_httpd_mod_auth_ntlm_winbind --> off allow_httpd_mod_auth_pam --> off allow_httpd_sys_script_anon_write --> off httpd_builtin_scripting --> on httpd_can_check_spam --> off httpd_can_network_connect --> off httpd_can_network_connect_cobbler --> off httpd_can_network_connect_db --> off httpd_can_network_memcache --> off httpd_can_network_relay --> off httpd_can_sendmail --> off httpd_dbus_avahi --> on httpd_enable_cgi --> on httpd_enable_ftp_server --> off httpd_enable_homedirs --> off httpd_execmem --> off httpd_manage_ipa --> off httpd_read_user_content --> off httpd_run_stickshift --> off httpd_setrlimit --> off httpd_ssi_exec --> off httpd_tmp_exec --> off httpd_tty_comm --> on httpd_unified --> on httpd_use_cifs --> off httpd_use_fusefs --> off httpd_use_gpg --> off httpd_use_nfs --> off httpd_use_openstack --> off httpd_verify_dns --> off
和# ls -lZ :
drwxr-xr-x. root root unconfined_u:object_r:public_content_rw_t:s0 Websites
我在监督什么?
原来你不得不在httpdconfiguration中明确地说Options + Indexes。 非常感谢你的回答。
首先,validation目录/服务器/网站/默认的权限。 您的Apache用户(在RHEL / CentOS apache中)是否有权限列出目录的angular色(至less为此用户的rx)?
其次,尝试validationSELinux是否负责。 尝试暂时只启用宽容模式
setenforce 0
如果现在起作用,那么您的目录/文件的上下文可能会有问题。 重新启用强制模式
setenforce 1
并recursion地重新标记你的新目录结构
chcon -R --reference=/var/www /Server/Websites
它有帮助吗?