As a part of setting up a development environment for creating web applications/sites to be deployed to Apache HTTP Server, one of the things I would highly recommend is making use of the userdir module. This module allows a user to create their own directory (under /home/[user]/public_html) and have that directory automatically be made accessible by Apache at http://localhost/~%5Busername%5D/ and thus skips a lot of the headaches that are caused by permission problems.
To set up this module, first you need to create this directory:
The next step is to enable the module:
sudo a2enmod userdir
Note that if you want to change the name of the directory or any other settings for this folder, you can do so by editing the /etc/apache2/mods-available/userdir.conf file.
Then, finally we just need to restart apache for the module to be loaded:
sudo /etc/init.d/apache2 restart
If it all went well, you should now be able to open your browser and browse to http://localhost/~%5Busername%5D/ and see the contents of your public_html directory.
Another very important thing to mention is that by default, PHP processing is disabled on this directory. If you need to turn on PHP processing, you need to modify the /etc/apache2/mods-available/php5.conf file:
# To re-enable php in user directories comment the following lines
# (from <IfModule …> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
php_admin_value engine Off
Like it says in the commented out sections of this file, you just need to comment out the mod_userdir.c section to enable PHP on the ~/public_html directory.