Apache for Multiple Users Linux – Ubuntu

When Apache is installed all web files go in he directory /var/www.
If there are multiple users on a system then every user can have his own web directory to store web files.

On Linux the following commands does that :

enlightened@enlightened-desktop:~$ sudo a2enmod userdir
Module userdir installed; run /etc/init.d/apache2 force-reload to enable.
enlightened@enlightened-desktop:~$ sudo /etc/init.d/apache2 restart
* Restarting web server apache2
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName                                                                         [ OK ]
enlightened@enlightened-desktop:~$

userdir is the Apache module which enables each user to use his own web directory.
This directory shall be public_html in the home folder. So create this folder and place an html file in it. This is also useful when you dont want to change permission of the /var/www folder and use a homely folder instead.

The url to be used should be localhost/~username/file.html.

Thats how webhosts do it to host multiple websites on one server. If you have used webhosting before then you should be knowing the url http://ip/~accountname/ used to access your website till your domain name nameserver changes take effect.

Popularity: 1% [?]

Leave a Reply