Archive for August, 2012

Configure Userdir to Serve Web Pages with Fedora 17

Wednesday, August 8th, 2012

Setting up a server running Fedora is a pain. One must do so many little things to please SElinux. A crucial task is enabling the user directories to have web access. Here is a sequence that worked on Fedora 17. It allows Apache to access the users’ home directories (by default ~/public_html/).

  1. Load /etc/httpd/conf/httpd.conf into an editor
  2. Change ‘UserDir disabled’ to ‘UserDir enabled’
  3. Uncomment the ‘UserDir public_html’ line
  4. Uncomment the ‘<Directory /home/*/public_html>’ directive.
  5. Save /etc/httpd/conf/httpd.conf
  6. Apply the proper permissions:
      # chmod 711 ~<username> for all usernames you want to enable.
      # chmod 755 -R ~<username>/public_html/> for all the usernames you want “enabled”

Run the following commands to please SELinux:

# setsebool -P httpd_enable_homedirs true
# chcon -R -t httpd_sys_content_t ~/public_html

Finally, reload Apache
  # service httpd restart