Install LEMP Ubuntu 17.10

In this post we will install LEMP ubuntu 17.10 (LInux, Nginx, MySQL, and PHP).

To begin, make sure you have a clean, fully updated installation of Ubuntu Server 17.10 ready.

How to Install LEMP on Ubuntu 17.10

Follow the following steps in order to install LEMP on Ubuntu 17.10.

Install Nginx

The first thing we will do is install Nginx on our server.

# apt install nginx -y

After it is completed installing you can open a browser and browse to your server’s IP address.  You should see the Nginx welcome page.

Now that we have Nginx installed we can install MySQL.

Install MySQL

Install MySQL with the following command:

# apt install mysql-server -y

When prompted enter the MySQL root user password you would like to use and confirm it.  Secure your MySQL installation with the following command:

$ mysql_secure_installation

Enter the same password that you entered above when prompted.  Don’t setup the VALIDATE PASSWORD PLUGIN.  Say yes to everything else.

Install PHP

Now we need to install PHP.

# apt install php-fpm php-mysql

Edit /etc/php/7.1/fpm/php.ini

# vim /etc/php/7.1/fpm/php.ini

Search for cgi.fix_pathinfo and uncomment it and set the value to 0:


Restart php:

# systemctl restart php7.1-fpm

Now we need to tell Nginx to start using PHP.  Open the /etc/nginx/sites-available/default file.

vim /etc/nginx/sites-available/default

Change the index line to look like this:

 index index.php index.html index.htm index.nginx-debian.html;

Notice we added in index.php as the first entry.  Next add the location block for PHP scripts:

location ~ \.php$ {
  include snippets/fastcgi-php.conf;
  fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;

Save the file and restart Nginx:

# systemctl restart nginx

Install PHPMyAdmin (Optional)

If you would like to make administrating your new MySQL server installation easier install PHPMyAdmin with this command:

# apt install phpmyadmin -y

When prompted for which webserver to deploy to, skip to next because Nginx isn’t one of the options.  Select Yes to configure a database for phpmyadmin.  Next enter a password for phpmyadmin and confirm.  Next we need to create a symbolic linc so that we can reach phpmyadmin:

ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin

You should now be able to browse to http://{your_server_ip)/phpmyadmin and see the login page.

Click here for more great articles from AdminTome Blog.


I hope you have enjoyed this article, if so please leave a comment below.  For more articles, please signup for the AdminTome Blog below.  Also please feel free to share the article to your friends using the buttons to the left.  Thanks again for reading this post.