Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
add comment

1 Answer

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
    </Directory>
</IfModule>

After this, everything you put in ~/public_html will automatically be available at http://example.com/~username. 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
add comment

Your Answer

 
discard

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.