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?

  • 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, 2011 at 9:34

1 Answer 1


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

# getsebool


# cat /etc/sysconfig/selinux

Try this:

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

and let me know if it works.

  • 2
    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, 2011 at 22:46
  • 1
    Centos have a wiki on this: wiki.centos.org/HowTos/SELinux
    – Rilindo
    Oct 2, 2011 at 13:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .