Search

Sunday, January 16, 2011

Problem with SELinux when changing Apache's DocumentRoot

With dual Operating System in my laptop, Fedora 14 and Windows XP, I need to set my Fedora Apache's DocumentRoot to point to windows-readable hardisk partition (NTFS). This change of path will allow me to work on same projects from both OS.
Current DocumentRoot is   /var/www/html   need to be set to   /media/Data/htDocs. For testing purpose, DocumentRoot would also be pointed to /home/user/htDocs (home directory). Problems would occurred mostly caused by SELinux policies.



DocumentRoot : /var/www/html : success
# chmod

DocumentRoot : /home/user/htDocs : failure

# setsebool -P httpd_access_user_home. 
# chcon -R -h -t -httpad_sys_content_t /home/user/htDocs 
$ /usr/sbin/setsebool -P httpd_enable_homedirs 1 
$ chcon -R -t httpd_sys_content_t public_beta

$ /usr/sbin/setsebool -P httpd_enable_cgi 1


# man httpd_selinux


SELinux restore context
dsfass
# restorecon /home/user/htDocs

Disable SELinux


DocumentRoot : /media/Data/htDocs : failure
dfdasf

Further Reading : 
SELinux related
How to SELinux
Setting up apache's virtual hosts : http://bobpeers.com/linux/apache_virtual_hosts
chmod tutorial  : http://catcode.com/teachmod

No comments:

Post a Comment