How To Install Linux, Nginx, MariaDB, PHP (LEMP Stack) on Linux Mint 19 (ok)
Last updated
Last updated
By Raj Last updated Aug 5, 2018 0 Share
This tutorial will help to install Nginx on Linux Mint 19 with PHP support (through PHP-FPM) and MariaDB support.
I hope you know what Nginx is? Nginx is an open-source web server which can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache.
Nginx was created by Igor Sysoev, released under BSD-like license.
First, we will install the MariaDB by issuing the following command. Update the repository index using the apt command.
Install MariaDB server using the following command.
You can quickly log in to MariaDB server without the MySQL root password by running sudo mysql -u root -p
or mysql -u root -p
command as root in Linux Mint.
Download the Nginx signing key from the official site.
Add Nginx repository to the system using the below commands.
Update repository index.
Install Nginx using the following command.
Open a web browser and hit it to,http://your.ip.addr.ess
The default document root of Nginx on Linuxmint 19 is /usr/share/nginx/html/. The configuration files are storedunder /etc/nginx directory.
Next is to install PHP through PHP-FPM (PHP-FPM (FastCGI Process Manager), it is an alternative PHP FastCGI implementation. Install it by using the apt command.
Edit the respective php.ini depending on the PHP version you have installed on the system.
set cgi.fix_pathinfo to 0.
Edit the /etc/php/7.2/fpm/pool.d/www.conf file.
Make sure to change the following value.
FROM:
TO:
Let’s create name-based virtual host on Nginx server for the following details.
Server Name : web.itzgeek.local Document Root : /usr/share/nginx/html/web.itzgeek.local
Create the configuration file /etc/nginx/conf.d/web.itzgeek.local.conf for our virtual host.
Add the following content.
Create the document root directory.
For testing the PHP, place a .php file on to the document root of the created virtual host. In the terminal copy/paste the following line.
Now, Copy/Paste this line into the index.php file and then save it.
Restart the services.
Create host entry for your domain (web.itzgeek.local) in /etc/hosts file or make an A record in case you have DNS server in your environment.
Add a host entry something like below.
Now open up a browser and type your domain in the web address.http://web.itzgeek.local
From the above screenshot, PHP is working through FPM/FastCGI, as shown in the Server API line.
Additionally, scroll the page further down to see all the modules that are enabled in PHP.
More To Read:
READ: How To Install phpMyAdmin with Nginx on LinuxMint 19 / LinuxMint 18
You should see the below page, and this confirms you that the Nginx is successfully installed on the server.Install Linux, Nginx, MariaDB, PHP (LEMP Stack) on Linux Mint 19 – Nginx’s Default Page