Install LAMP ubuntu 16.04

Install and configure LAMP

Install apache2:

sudo apt-get install apache2

Set Global ServerName to Suppress Syntax Warnings. Append in /etc/apache2/apache2.conf (bottom of the file):

ServerName IP_ADDRESS

Launch the command:

sudo apache2ctl configtest

you should receive the message Syntax OK.

Restart Apache to implement the changes:

sudo /etc/init.d/apache2 restart

Adjust the Firewall to Allow Web Traffic

sudo ufw app list

http://your_server_IP_address to see the welcome page from apache.

Install MySQL

sudo apt-get install mysql-server

Set a secure password for the root user and launch the script to remove some dangerous defaults and lock down access to our database system

sudo service mysql restart //restart the service
mysql_secure_installation

try the connection to the db with:

mysql -u root -p

Install PHP

sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql

Modify the way that Apache serves files when a directory is requested serving php file before instead of html edit the file:

/etc/apache2/mods-enabled/dir.conf

And insert the php index file before:

<IfModule mod_dir.c>
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>

restart apache: sudo /etc/init.d/apache2 restart

test php with a phpinfo page.

Resources:

huckbit

Programmer by day and mostly by night as well.