asas<
1. First of all, enable mod_userdir module in /etc/httpd/conf/httpd.conf
IfModule mod_userdir.c>
#
# UserDir is disabled by default since it can confirm the presence
# of a username on the system (depending on home directory
# permissions).
#
# UserDir enabled
#
# To enable requests to /~user/ to serve the user's public_html
# directory, remove the "UserDir disabled" line above, and uncomment
# the following line instead:
#
UserDir public_html
</IfModule>
2. Now we create public_html under user home directory.
mkdir ~user1/public_html
3. To make it work with SELinux, we need to change SELinux context of the public_html.
chcon --reference /var/www/html ~user1/public_html
4. Also change the permission of the public_html from 700 to 711.
chmod 711 ~user1/public_html
5. Enable SElinux boolean for httpd_enable_homedirs
sesetbool -P httpd_enable_homedirs 1
6. * Enable SElinux module mypol.pp
semodule -i mypol.pp
7. * Enable SELinux boolean for httpd_read_user_content
setsebool -P httpd_read_user_content 1
8. Restart httpd.
9. Done!
* is optional
No comments:
Post a Comment