Ubuntu Tips: 6 - Apache Per-user Web Directories
This document contains the steps necessary to configure the Apache web server to recognise per-user web directories
Author: Matthew Wittering | Published: 2nd November 2009
Multiple user operating systems like Ubuntu Linux running Apache web server allow system each user to run a web site under their own home directory. The module which allows this reality is the UserDir Directive. Activating this module will configure the Apache web server to handle to requests for content using urls which follow the format of http://www.example.com/~user/index.htm. To configure the Apache with per-user web directories complete the following steps.
Step 1 - Create public_html folder
Start by opening a new terminal window and run the following two commands to create the appropriate folder and permissions to make user web content available.
$ mkdir public_html $ chmod 755 public_html
Step 2 - Install user directory model
To install the userdir module run the following command in your terminal window. This command will require the administrator password.
$ sudo a2enmod userdir
Step 3 - Restart the apache service
Now restart Apache with the following command to activate the new userdir module.
$ sudo /etc/init.d/apache2 restart
Once the service has been restarted successfully you will be able access individual user public directories for web sites on your own Ubuntu server.
This work is licenced under a Creative Commons Licence
I am a graduate of Lougborough University where I read Computing and Management BSc (Hons) earning a 2:1 classification.