Installation of a web server LEMP (Linux, Nginx, MySQL, PHP)

The installation of a server LEMP Linux + Nginx + MySQL + PHP might be more useful and efficient than an Apache (server LAMP).

Nginx installation

It will be essential to know the machine’s IP address to install from ifconfig.

From your system on Debian 8, we install nginx via the command :

Your server nginx is now operational and available except if a rule prevent the streams HTTP and in this case, you have to check netfilter (iptables / ufw).


MySQL installation

Then, you need to install MySQL via the following command :

During the installation, you will be asked to choose a password root.

It is advisable to carefully choose your password preferably alphanumerical and including special characters.

To proceed with the installation, the following command has to be executed :

Enter your password root when requested and confirm the four following questions with yes :


PHP installation

Since Nginx does not contain PHP natively, it is important to install the PHP process manager called PHP FPM (FastCGI Process Manager) :

Then, we are going to change the PHP configuration by changing the cgi.fix_pathinfo variable value to 1 or simply un-comment the line :

Finally, we restart the PHP service :


Nginx configuration

Now, we are going to change our default vhost so that Nginx uses the PHP processor :

The red elements need to be added to the default vhost file :

Now, we need to check the Nginx configuration then reload the service and in case of error, we would have to review the previous configured file :


Use

To conclude, we are going to test pour LEMP server with a page phpinfo :

The result is available from the url http://server_domain_or_address_IP/phpinfo.php and it leads to the following result :

From now on, your LEMP server is operational and will allow you performance enhancements, especially in terms of requests number compared to a LAMP server on Apache.


Installation of a web server LEMP (Linux, Nginx, MySQL, PHP)
Vote