Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I’ve just installed Ubuntu Server on a new server and have been looking around for tutorials on setting up a web server with multiple user accounts.

How I’ve set small web servers like this in the past is the same way most of the tutorials suggest, by creating directories within /var/www/ and then using Apache virtual hosts to redirect the traffic.

What I’m trying to do is create a system whereby the user accounts are setup under /home/new_account/, and then the public_html directory is within that, which is where the virtual hosts links to.

Is it as simple as that? If I wanted to automate it from a control panel, can I create accounts easily using, say PHP?

share|improve this question
up vote 2 down vote accepted

You'd need to enable the userdir module for apache

sudo a2enmod userdir

And restart apache (sudo service apache2 restart)

If you need to use php as well inside the user directories :

sudo apt-get install php5
sudo a2enmod php5

Open /etc/apache2/mods-available/php5.conf and remove/comment the following lines :

<IfModule mod_userdir.c>
    <Directory /home/*/public_html>
        php_admin_value engine Off

After this, everything you put in ~/public_html will automatically be available at Make sure you are aware of the security issues involved before you do this (especially the php part)

Source: Ubuntu Wiki

share|improve this answer
That’s perfect, thanks for the help @Capt.Nemo - it’s only for internal/local network use, security risk is reduced a little. – Thomas Edwards Jun 25 '11 at 16:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.