Saturday, August 1, 2009

How to enable Apache public_html for user on Ubuntu

Suppose that you want each user to have their own public_html in their home directory.

For example, user with username ahmad, can have his own Web site at
http://localhost/~ahmad


Enable mod_userdir

To achieve that, first, what you need to do is to enable mod_userdir, which is installed by default with Apache2.
sudo a2enmod userdir

Create public_html directory

Second, the user need to create public_html directory in their home directory.
mkdir public_html

Restart Apache

Finall, you should restart Apache.
sudo /etc/init.d/apache2 restart