To enable Apache for per-user directory, there are some settings need to configure.
What is per-user directory?
Apache server default directory for webpage files is at /var/www. All website files are put here. Per-user directory let different user have different website root directories under their own home directory.
- Ubuntu 12.04 LTS
- Ubuntu default LAMP stack
- Assume all default Apache, PHP, MySQL(LAMP) are already working on Ubuntu. Open http://localhost/ in your browser to check if Apache is properly working.
Now we just have to modify some configurations to enable per-user directory feature.
Enable ‘userdir’ module
sudo a2enmod userdir
Create public_html folders under each user home directory and assign proper permissions
chmod 755 ~/public_html
sudo vim /etc/apache2/mods-available/php5.confedit PHP configuration file
- comment(#) some lines in configuration files:
<IfModule mod_userdir.c> <Directory /home/*/public_html> php_admin_value engine Off </Directory> </IfModule>
Restart Apache service
sudo service apache2 restart
Now web address should be