Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a folder (which is NOT the conventional /var/www/html folder!) /Server/Websites/Default on my Centos6.4 server. There is only one file, phpinfo.php (with the obvious code in it). Running http://localhost/Default/phpinfo.php in firefox, shows the correct php info page. When I visit http://localhost/Default/ page, it shows me a Forbidden 'You don't have permission to access / on this server.' page. I want it to list the directory contents.

In my /etc/httpd/conf/httpd.conf file, I have (too long to display, so Im pasting some key lines that I think matter):

DocumentRoot "/Server/Websites"
<Directory /Server/Websites>
    Options +Indexes Includes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

SELinux wise, I have also for # 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

And # ls -lZ:

drwxr-xr-x. root root unconfined_u:object_r:public_content_rw_t:s0 Websites

What am I overseeing?

share|improve this question
    
Can you please add the output of ls -lZ /Server as well? –  dawud Jul 22 '13 at 15:52

2 Answers 2

up vote 1 down vote accepted

It turned out you had to explicitly say Options +Indexes in the httpd config. Thank you all so much for your answers.

share|improve this answer

First of all, verify the permissions of the directory /Server/Websites/Default. Does your Apache user (in RHEL/CentOS apache) has permissions to list the contect of the directory (at least r-x for this user)?

Secondly, try to verify whether SELinux is responsible. Try to temporarily enable permissive mode only with

setenforce 0

If it works now there may be a problem with context of your dirs/files. Re-enable enforcing mode with

setenforce 1

and relabel your new directory structure recursively with

chcon -R --reference=/var/www /Server/Websites

Does it help?

share|improve this answer
    
It wasn't quite the fault of selinux, see my own answer. I like the ease of how you would test selinux and how you copy labels accross. Thanks –  Florian Mertens Jul 23 '13 at 10:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.