Setting up Apache Homepages

I keep needing to reconfigure new machines so that users can have home directories served as Apache pages. These are for internal servers rather than internet facing ones, so the security requirements are suppressed a little.

Note: I am not using SELinux on these machines (I know I should be).

These instructions are not intended to be definitive, they are more an aide-memoir for myself so I don’t have to keep doing the same Google search every couple of months. YMMV.

I am assuming that you are using FC15 or FC16, in which case mod_userdir should already be installed for you.

Edit you /etc/httpd.d/conf to contain the following entries:

UserDir disabled         # Completely disable it
UserDir enabled richard  # Enable it only for my user
UserDir public_html      # Set the name of the folder to serve

Once you’ve done this, you also need to set the appropriate permissions on the directories, e.g.:

# sudo chmod 711 /home/richard
# sudo chmod -R 755 /home/richard/public_html

Now, you should just need to restart apache:

# sudo service httpd restart

Your pages should now be available from:

http://localhost/~richard

et Voila!


Tags: linux, apache, homepages
blog comments powered by Disqus