LEMP stack stands for Linux, Nginx, MySQL, MariaDB, MongoDB, PHP, Perl, Python & phpMyAdmin. LEMP is bunch of open source software which is developed by different organization.
NGINX stands for engine-x is a free, open-source, high-performance HTTP server and reverse proxy, as well as an mail (IMAP/POP3) proxy server. Nginx is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption. Currently 146 million websites use NGINX to deliver super-fast web experiences. The big companies like (WordPress, facebook, GitHub & cloudflare, etc..) using nginx.
PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation with some additional features which is very useful for busy sites, like 20000+ hits per day. Navigate to PHP-FPM site to know more about it.
Remove Existing LAMP stack
I would advise users to remove existing LEMP stack completely to avoid conflicts. Use the following single command to purge everything.
[Remove LAMP Stack] $ sudo apt-get purge apache2* php7.0* mysql* phpmyadmin* $ sudo apt-get autoremove $ sudo apt-get autoclean [Remove Apache Configuration files] $ whereis apache2 $ sudo rm -Rf /etc/apache2 [Remove MySQL Configuration files] $ sudo rm -Rf /var/lib/mysql/ $ sudo rm -Rf /etc/mysql/
Then recheck once, if anything still available. Using below commands.
$ dpkg -l | grep apache2* $ dpkg -l | grep php7.0* $ dpkg -l | grep mysql* $ dpkg -l | grep phpmyadmin*
1) Install Nginx
Linux Mint 1 (Sarah) shipped with latest Nginx version, so just fire the below command to install Nginx on Mint. For older version of Mint users, add Nginx Repository to get latest stable version. The default Nginx web root directory is located at
[Install Nginx] $ sudo apt-get install nginx [Start, Enable & check the Status of Nginx service on systemd System] $ sudo systemctl start nginx.service $ sudo systemctl enable nginx.service $ sudo systemctl status nginx.service [Start, Enable & check the Status of Nginx service on SysVinit System] $ sudo service nginx start $ sudo service nginx status $ sudo chkconfig nginx on
Nginx Version checking
$ nginx -v nginx version: nginx/1.10.0 (Ubuntu)
2) Check Nginx Index page
Make sure you have to change the default web root in
/usr/share/nginx/html, only for Mint 18 users. Finally restart
sudo systemctl restart nginx.service. Now, open your web browser and navigate to http://localhost/ or http://your-server-ip-address/ or http://127.0.0.1/
3) MariaDB installation
MariaDB is a drop-in replacement for MySQL. MariaDB is open source relational database management system (RDBMS) which is supporting database access. By default Linux Mint included MariaDB 10.0 to their official repository. So, just fire the below command to install it. For older system, add MariaDB 10.x to get latest stable version.
[Install MariaDB] $ sudo apt-get -y install mariadb-server mariadb-client
[Start, Enable & check the Status of MariaDB service on systemd & SysVinit System]
[Start, Enable & check the Status of MariaDB service on systemd System] $ sudo systemctl start mysql.service $ sudo systemctl enable mysql.service $ sudo systemctl status mysql.service [Start, Enable & check the Status of MariaDB service on SysVinit System] $ sudo service mysqld start $ sudo chkconfig mysqld on
3a) Set MySQL root password
By default MySQL/MariaDB instance doesn’t come with root password and we have to set by running below command to make DB more secure. Run
mysql_secure_installation command which will set root password and adjust other settings too, such as removing anonymous users, Disallow root login remotely, Remove test database and access & Reload privilege tables.
[MariaDB Secure installation] $ sudo mysql_secure_installation Enter current password for root (enter for none): Enter Your Current Password OK, successfully used password, moving on... Set root password? [Y/n] n ... skipping. Remove anonymous users? [Y/n] y ... Success! Disallow root login remotely? [Y/n] y ... Success! Remove test database and access to it? [Y/n] y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reload privilege tables now? [Y/n] y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB!