1/28/2015

CentOS serving home directory with Apache

CentOS serving home directory with Apache



<IfModule mod_userdir.c>
First, edit /etc/httpd/conf/httpd.conf, and find the section that begins:If you want to setup CentOS to allow Apache to serve out the user home directories there's a couple of quick settings that need to be changed.
Comment out UserDir disabled, and uncomment the line saying UserDir public_html.
Then, restart httpd, and change one of the SeLinux booleans:
service httpd restart
setsebool httpd_read_user_content on
The final thing to make sure of is that the /home/username folder is world executable, and make the public_html folder:
chmod a+x ~/
mkdir ~/public_html
echo "Hello World" > ~/public_html/index.html
The user directory needs to be 711 and the public_html folder 755.