How to Install Drupal 7 on CentOS 7 with Nginx, MariaDB and PHP-FPM

drupalIn this tutorial we will help you install the latest version of Drupal on your CentOS 7 VPS with Nginx, MariaDB and PHP-FPM. Before we continue, we assume that you already have LEMP stack (Linux, Nginx, MariaDB and PHP) installed on your server. If not, you can follow the How to install LEMP tutorial to prepare your linux vps. If you already have LEMP stack installed on your server, we are good to go.

First of all, you need to upgrade all your system software to the latest version available. This can be done using the command:

## yum update

Also, you need to install the required packages using yum:

yum install php-gd php-mbstring php-xml

Next, you need to download Drupal from the official web site. The latest stable release is 7.32 so you can download it with the following command:

## wget

After that, you should unpack the tar.gz archive and move that directory to /var/www/html

## tar -zxvf drupal-7.32.tar.gz
## mv drupal-7.32 drupal
## mv drupal /var/www/html/

Now you can navigate to the /var/www/html/drupal/sites/default/ directory on your server, make a copy of the default.settings.php named settings.php and make that directory and file writable to all:

## cd /var/www/html/drupal/sites/default/
## cp default.settings.php settings.php
## chmod 666 settings.php
## chmod 777 /var/www/html/drupal/sites/default

After you complete these few steps, you are ready to create the database. Log in to your MariaDB as root

## mysql -u root -p

and enter the following commands:

## create database DrupalDB;
## grant all on DrupalDB.* to Drupal_user@localhost identified by "sEcReT_pASsWoRd";
## exit

It is time to configure the web server so you can access the Drupal directory on your server using your domain name.

Navigate to /etc/nginx/conf.d with the command:

## cd /etc/nginx/conf.d

and create file drupal.conf:

## nano drupal.conf

with the following content:

server {
    listen 80;
    root /var/www/html/drupal;
    access_log /var/log/nginx/;
    error_log /var/log/nginx/;
    index index.php;

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

    location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
        access_log off;
        expires max;
    location ~ /\.ht {
        deny  all;
    location ~ \.php {
        try_files $uri = 404;
        fastcgi_index index.php;
        include /etc/nginx/fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

Do not forget to replace with your domain name.

Now, restart your Nginx web server:

systemctl restart nginx

That’s it. It is time to use your favorite web browser and navigate to:

Again, do not forget to replace with your domain name.
You should see something like this:


Now you can follow the instructions and finish the Drupal 7 installation on your CentOS 7 VPS.

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 Drupal 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.

Install and run WordPress cached with Redis on a Linux VPS
How to install Mahara on Ubuntu
How to install Elkarte Community Forum on Ubuntu 14.04
There are currently no comments.