Using Apache Web Server's UserDir Directive To Provide Personalized Web Pages

- - 1 comment
Using Apache Web Server's UserDir Directive To Provide Personalized Web Pages: As some of you may know, a good number of Linux distributions are ideal for web servers simply because they are bundled with the best and most excellent free and open-source server and web development software such as MySQL, PHP, Perl, Python and Apache.

I have here a quick and easy tutorial on how you can set up Apache web server to enable Linux users have their own personal website. Usually, you want this configuration for the following reasons:

1. Give users a default place to setup their own web pages.
2. Easily manage configuration for all users.

The instructions here assumes you already have installed Apache on your preferred Linux distro and know your way around its configuration files. Also, this tutorial assumes that you are familiar with navigating around the file system. I am doing this on a GNU/Linux Debian Unstable distribution.

Using UserDir Directive:

1. Open a terminal window and login as root.

2. Enable the module for UserDir Directive using the following commands:

# a2enmod userdir

# /etc/init.d/apache2 reload

3. Usually, those commands take care of the default configuration for UserDir Directive. If you want to look at the configuration files, then go here “/etc/apache2/mods-enabled/userdir.load” and here “/etc/apach2/mods-enabled/userdir.conf”.

4. Place your web pages or HTML files here: “/home/user/public_html”. Make sure to replace the “user” with your login name. All users on this computer can make their own web pages in their own “public_html” directory. If you don't see any directory with that name, create it by using this command (no need to become root):

$ mkdir /home/username/public_html

5. Finally, open your favorite web browser and access your web pages through this url: “http://localhost/~username/yourpage.html”

Example: http://localhost/~testuser/mywebpage.html

The reference below contains a lot of information about UserDir Directive that includes instructions on customizing it to your preferences.


If you have already installed Apache2 and its manual, go here: http://localhost/manual/en/mod/mod_userdir.html

You may also view the reference online:

This article was written by Benjamin Canlas for Tech Source.

1 comment