By default Apache puts all the web files into a single directory (commonly /var/www). If there are multiple users on a system then every user can have his own web directory to store the web files.
userdir is the Apache module which enables each user to have a separate directory to store web files. 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.
Install/Enable the userdir module on ubuntu by issuing the following command.
$ sudo a2enmod userdir Module userdir installed; run /etc/init.d/apache2 force-reload to enable.
After userdir is installed, apache needs to be restarted
$ 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 ]
Now the url for a particular user 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 nameserver changes take effect.