How to Install WordPress with PHP 7.1 and Nginx on Debian 9

In this guide, we will walk you through the basic installation process of WordPress on a Debian 9 VPS with Nginx, MariaDB and PHP 7.1. WordPress is the most popular CMS in the world with unlimited customization options. This should work on other Linux VPS systems as well but was tested and written for Debian 9.

1. Update the system and install necessary packages.

2. Install MariaDB 10.1

When the installation complete, run the following command to secure your installation:

Next, we need to create a database for our WordPress instance.

3. Install and configure PHP 7.1

PHP 7.1 is not available via the default Debian repositories, so we will add the “packages.sury.org/php” repository, update the system and install the PHP 7.1 packages.

To install the latest version of PHP 7.1 and all necessary modules, run:

Change few default PHP settings:

PHP-FPM process manager has three choices: Static, Dynamic and Ondemand. The default setting for the process manager is “dynamic”, we will change it to “ondemand”.
Rename the default FPM pool configuration file and create a new one:

Restart PHP-FPM:

4. Install and configure Nginx

Install Nginx from the official Debian repositories:

Create a new Nginx server block with the following content:

Activate the server block by creating a symlink:

Test the Nginx configuration and restart the server by running the following commands:

5. Install WordPress

Create a new directory for your WordPress site:

Download and extract the WordPress package:

Set the correct permissions:

Finally, run the WordPress installation script by accessing the URL in your web browser of choice. http://example.com/, enter the details for the database we created earlier in this post and create your WordPress admin user.


Of course, you don’t have to Install WordPress with PHP 7.1 and Nginx on Debian 9 if you use one of our WordPress Maintenance Services, in which case you can simply ask our expert Linux admins to Install WordPress with PHP 7.1 and Nginx on Debian 9 for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.