How to install Backdrop CMS with Nginx on an Ubuntu 16.04 VPS

In this tutorial we are going to provide you with step-by-step instructions on how to install Backdrop CMS with Nginx on an Ubuntu 16.04 VPS.
Backdrop CMS is an open-source and easy to use Content Management System used to build attractive and professional websites.

Make sure your package list and the OS packages are up to date by running the following commands:

sudo apt-get update
sudo apt-get upgrade

To install the latest Nginx version from the official Nginx repository, edit the ‘/etc/apt/sources.list’ file:

sudo vi /etc/apt/sources.list

Add the following lines:

deb http://nginx.org/packages/ubuntu/ xenial nginx
deb-src http://nginx.org/packages/ubuntu/ xenial nginx

Install MySQL:

sudo apt-get install mysql-server

Stop and remove Apache service:

sudo service apache2 stop
sudo apt-get remove apache2

Install Nginx on your virtual server:

sudo apt-get update
sudo apt-get install nginx

Configure Nginx to start on boot:

sudo update-rc.d -f nginx defaults

Install PHP and PHP modules required by Backdrop CMS:

sudo apt-get install php7.0 php7.0-cli php7.0-fpm php7.0-mbstring php7.0-mysql php7.0-gd php7.0-mcrypt php7.0-imap uw-mailutils libgd-tools libmcrypt-dev mcrypt php-pear libgd-dev

Then, start with the Backdrop CMS installation procedure. Get the latest version of Backdrop CMS available at their official website to a directory of your virtual server and extract it using the following commands:

sudo apt-get install wget unzip
cd /opt/
wget https://github.com/backdrop/backdrop/releases/download/1.4.3/backdrop.zip
unzip backdrop.zip
mkdir -p /var/www/html
mv backdrop /var/www/html

Create a new Nginx configuration file and add the following virtual block for your domain name:

vi /etc/nginx/conf.d/your-domain.com.conf

Add the following lines:

server {
listen 80;
server_name your-domain.com;
root /var/www/backdrop/;
index index.php;
access_log /var/log/nginx/your-domain.com-access.log;
error_log /var/log/nginx/your-domain.com-error.log;
charset en_us.UTF-8;

location / {
error_page 404 = @backdrop; }
location @backdrop { rewrite ^(.*)$ /index.php?q=$1 last; }

location ~ \.php$ {
 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 include fastcgi_params;

Do not forget to replace your-domain.com with your actual domain name. Then, delete the ‘default’ Nginx configuration file:

rm /etc/nginx/conf.d/default.conf

Open the ‘/etc/php/7.0/fpm/pool.d/www.conf’ file and change the ‘listen’ variable:


listen = /run/php/php7.0-fpm.sock


listen =;

Locate the PHP configuration file:

# php -i | grep -i php.ini
Configuration File (php.ini) Path => /etc/php/7.0/cli
Loaded Configuration File => /etc/php/7.0/cli/php.ini

Edit the ‘/etc/php/7.0/cli/php.ini’ configuration file:

vi /etc/php/7.0/cli/php.ini

Add/modify the following settings:

max_execution_time = 300
max_input_time = 300
memory_limit = 128M
post_max_size = 32M
upload_max_filesize = 32M

The web server user (www-data) needs to be able to write to files and directories inside the ‘/var/www/backdrop’ directory, so it can easily be accomplished by executing the following command:

sudo chown www-data:www-data -R /var/www/backdrop/

Test the nginx configuration:

# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

If test is successful, restart php7.0-fpm and Nginx services for the changes to take effect:

sudo service php7.0-fpm restart
sudo service nginx restart

Backdrop CMS requires a database to work as this is where data is saved, so create a new MySQL database:

mysql -u root -p
mysql> create database backdropdb;
mysql> GRANT ALL PRIVILEGES ON backdropdb.* TO 'backdropuser'@'localhost' IDENTIFIED BY 'Y0UR-PASSW0RD';
mysql> flush privileges;
mysql> quit

Open http://your-domain.com/ using your favorite web browser and follow the easy instructions. Once installed, log in to the administrator back-end and configure Backdrop CMS according to your needs.

That is it. The Backdrop CMS installation is now complete.

Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install Backdrop CMS with Nginx 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.

Categories: Tutorials

View Comments

Leave a Comment