How To Install WordPress with LEMP on Ubuntu 16.04

How To Install WordPress with LEMP on Ubuntu 16.04



WordPress is the most popular CMS (content management system) on the internet. It allows you to easily set up flexible blogs and websites on top of a MySQL backend with PHP processing. WordPress has seen incredible adoption and is a great choice for getting a website up and running quickly. After setup, almost all administration can be done through the web frontend.

In this guide, we’ll focus on getting a WordPress instance set up on a LEMP stack (Linux, Nginx, MySQL, and PHP) on an Ubuntu 16.04 server.



In order to complete this tutorial, you will need access to an Ubuntu 16.04 server.

You will need to perform the following tasks before you can start this guide:

  • Create a sudo user on your server: We will be completing the steps in this guide using a non-root user with sudo privileges. You can create a user with sudo privileges.
  • Install a LEMP stack: WordPress will need a web server, a database, and PHP in order to correctly function. Setting up a LEMP stack (Linux, Nginx, MySQL, and PHP) fulfills all of these requirements.
  • Secure your site with SSL: WordPress serves dynamic content and handles user authentication and authorization. TLS/SSL is the technology that allows you to encrypt the traffic from your site so that your connection is secure. The way you set up SSL will depend on whether you have a domain name for your site.


I. Install a LEMP stack:

Step 1: Install the Nginx Web Server


Step 2: Install MySQL to Manage Site Data


Step 3: Install PHP for Processing

We will change both of these conditions by uncommenting the line and setting it to “0” like this:


II. Configure LEMP Stack

Step 1: Create a MySQL Database and User for WordPress


Step 2: Set Up Nginx Server Blocks (Virtual Hosts)

Create Server Block File


Step 3: Adjust Nginx’s Configuration to Correctly Handle WordPress




Now, we can check our configuration for syntax errors by typing:

If no errors were reported, reload Nginx and PHP-fpm by typing:


Step 4: Download and Configure WordPress





  1. LEMP
  2. WordPress on LEMP