Posts Tagged ‘apache’

Apache website in ~user/public_html directories

June 27th, 2009

One very useful thing to do when hosting a website with apache is to give each user a website in the ~/public_html directory that can be accessed through website.example.com/~username.

The easiest way to do this is to enable a module called mod_userdir in apache. This module is installed by default in most linux repositories with apache2, but it is not enabled.

To enable this module, use thea2enmod command to enable modules in apache:

sudo a2enmod userdir

and restart apache

sudo /etc/init.d/apache2 restart

And in the http.conf file often found in /etc/apache2/ add the line

UserDir public_html

Now every user on that computer can use ~/public_html to host a website.

More information about mod_userdir here