LEMP Linux Nginx MariaDB Php Phpmyadmin on Debian Jessie

Here’s a look at how I configured a LEMP server on Debian Jessie

Install nginx using command :

sudo apt-get install nginx
sudo apt-get install php5 php5-fpm php5-mysql

This location will be your Document Root in the nginx virtual configuration file later on. By adding a -p to the line of code, the command automatically generates all the parents for the new directory.

sudo mkdir -p /var/www/zanca.it/www

We need to grant ownership of the directory to the right user, instead of just keeping it on the root system. You can replace the “www-data” below with the appropriate username.

sudo chown -R www-data:www-data /var/www/zanca.it/www
sudo vim /var/www/zanca.it/www/index.html

We can add some text to the file so we will have something to look at when the the site redirects to the virtual host.

    <h1>Success: You Have Set Up a Virtual Host</h1>

The next step is to create a new file that will contain all of our virtual host information.

vi /etc/nginx/sites-available/zanca.it
server {
    root /var/www/zanca.it/www;
    index index.html index.htm index.php;

    access_log /var/log/nginx/wp.dev.access.log;
    error_log /var/log/nginx/wp.dev.error.log;

    server_name zanca.it;

    location / {
        try_files $uri $uri/ /index.php?$args;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;

    location ~ /\.ht {
        deny all;

Make a symbolic link to /site-enabled to enable it

sudo ln -s /etc/nginx/sites-available/zanca.it /etc/nginx/sites-enabled/zanca.it

To check if syntax works

sudo nginx -t


sudo service nginx restart

Now install MariaDB

apt-get install mariadb-server mariadb-client

check it

mysql -V

secure it


I must stress that this is not recommended for a production environment.

To avoid  this error in phpmyadmin

ERROR 1698 (28000): Access denied for user 'root'@'localhost'
mysql -u root -p

At the mysql prompt enter the following:

use mysql;
update user set plugin='' where User='root';
flush privileges;

and phpMyAdmin

sudo apt-get install phpmyadmin