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

I've just setup a CentOS 5.5 install with Apache and Mapserver.

While trying to do the tutorial for mapserver, I've found that Apache returns 403 forbidden when accessing any of the tutorial files, yet for any file I create and upload it serves it normally.

When checked with ls -l the permissions are exactly the same, the user and group are exactly the same, and the files are in the same folder - yet I can't access a .txt from the tutorial whereas if I copy the contents into another file I can access it.

Apache's error logs simply say I don't have permission to access the file, so isn't telling me anything more useful, and my searches have all told to ensure the permissions are set correctly (they look the same).

It's a fresh install with my web docs residing in /var/www and find /var/www/ -name .htaccess doesn't return anything so I'm confident there aren't any .htaccess files preventing my from accessing anything.

nginx can serve the files properly, Apache can't, so I think this narrows it down to a permissions issue within Apache but don't have a lot of experience with Apache and can't think of where to begin.

Any idea where I should look next?

share|improve this question
    
Anything defined in a .htaccess file can also be defined in the direct apache config, usually found in /etc/apache2/sites-enabled/ –  gnur Sep 8 '11 at 9:34

1 Answer 1

up vote 5 down vote accepted

I suspect that you have SELinux set to enforcing by the default. And it is the cause of this problem, check with:

# getsebool

or:

# cat /etc/sysconfig/selinux

Try this:

# chcon -R -t httpd_sys_content_t /var/www/webdocs

and let me know if it works.

share|improve this answer
1  
This worked. Would you happen to have any resources that explain how SELinux works, and why it might allow access to one file but not another? –  djlumley Sep 8 '11 at 22:46
    
Centos have a wiki on this: wiki.centos.org/HowTos/SELinux –  Rilindo Oct 2 '11 at 13:02

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.