How to install LEMP (Linux, Nginx, MySQL, PHP) on Ubuntu

Nginx is a lightweight webserver/reverse proxy server and email (IMAP/POP3) proxy server, distributed under a BSD-like protocol, available on UNIX, GNU/Linux, Run on operating systems such as BSD, Mac OS X, Solaris, and Microsoft Windows. It is an open-source web server that is fast and uses fewer system resources than Apache. When under light load, the difference between Apache and Nginx is negligible. However, under heavy load, Nginx can expand accordingly and operate quickly without taking up too much memory resources like Apache.

How to install LEMP (Linux, Nginx, MySQL, PHP) on Ubuntu

1. Update Ubuntu system

sudo apt-get update

2. Install MySQL

sudo apt-get install mysql-server php-mysql
sudo /usr/bin/mysql_secure_installation

3. Install Nginx

sudo apt-get install nginx

Running Nginx

sudo service nginx start

4. Install PHP

sudo apt-get install php-fpm

Edit php.ini file:

sudo nano /etc/php/7.2/fpm/php.ini

Replace “;cgi.fix_pathinfo=1” to “cgi.fix_pathinfo=0“. Save and Close

5. Install phpmyadmin

sudo apt-get install phpmyadmin

You can select apache or lighttpd.

Create a symbolic link

sudo ln -s /usr/share/phpmyadmin/ /usr/share/nginx/html

6. Check your Nginx status by going to http://youripaddress