How to install LAMP server in Ubuntu 16.04 and add www document root to user's home
Asked
Active
Viewed 7,597 times
1 Answers
0
Install LAMP server:
sudo apt-get install lamp-server^
Enable userdir
module:
sudo a2enmod userdir
Enable PHP execution in user directory:
sudo nano /etc/apache2/mods-available/php7.conf
(if you use PHP5, it's php5.conf)
Comment this part:
#<IfModule mod_userdir.c>
# <Directory /home/*/public_html>
# php_admin_flag engine Off
# </Directory>
#</IfModule>
Press Ctrl+X to save
Enable directory listing:
sudo nano /etc/apache2/apache2.conf
Add this:
<Directory /home/*/public_html/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Press Ctrl+X to save
Restart apache:
service apache2 restart
Now put your php files in /home/yourname/public_html directory and go to
http://localhost/~yourname from your web browser.

Naveen
- 9,365
- 11
- 43
- 70