How to fix Apache permission denied error due to SELinux
April 13, 2011 13:47:34 Last update: April 13, 2011 13:49:20
You get "permission denied" error from Apache HTTPD for a page. And you checked file/directory permissions (the whole directory path, not just the file) and everything in
Open
These are the steps to fix:
httpd.conf. If everything seemed right, then SELinux may be blocking the access.
Open
/var/log/httpd/error_log, you may see a line like this:
[Wed Apr 13 15:50:35 2011] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:httpd_t:s0
These are the steps to fix:
- If the directory resides in a user home directory:
# setsebool -P httpd_read_user_content 1
- Create a policy package from the audit log:
# grep httpd /var/log/audit/audit.log | audit2allow -M mypol ******************** IMPORTANT *********************** To make this policy package active, execute: semodule -i mypol.pp
- Apply the policy package just created
# semodule -i mypol.pp
- Restart apache httpd:
# apachectl restart
1 comment 