Sunday, December 20, 2009

Enable user directories in Apache2

Its been a while since Apache2 was introduced. The configurations are found in apache2.conf and user specific settings can be added to httpd.conf in the /etc/apache2 directory. One major difference from previous version is the method to enable the user directory modules.

The Linux users can have their individual websites but this needs to be enabled and the web server restarted. At the command line type

sudo a2enmod userdir
sudo /etc/init.d/apache2 restart

This enables the Userdir module in /etc/apache2/mods-enabled/userdir.conf and users can create pages in the directory /home/username/public_html
This is managed by the directive

<directory /home/*/public_html>


Other basic configurations can be
  1. Disable a user from serving webpages (e.g. root and user1)

    Userdir disabled root user1

  2. Access URL as http://servername/~username

    Userdir public_html

  3. Access URL as http://servername/web/username

    Userdir web

2 comments:

Guru Besar said...

Still don't understand. Why do we need to enable this, again?

Tboxmy said...

Web servers can provide each individual user to create their own web pages using their home directory when User Directories are enabled.

Blog Archive