How to Install Node based Roadiz CMS with Nginx on Debian

Roadiz is a free and open-source content management system based on a node system. Roadiz allows you to create your own data schema from scratch and to organize your content as your need. Roadiz is specially designed for designers and developers to build strong experiences together. Roadiz uses a centralized document management interface that can be used to store all your images, videos, and PDFs. Roadiz allows you to switch multiple themes for one content basis.

In this tutorial, we will learn how to install Roadiz on a Debian 11 server.

Requirements

  • A server running Debian 11.
  • A root password is configured on your server.

Install Nginx, PHP, MariaDB

First, you must install Nginx web server, MariaDB database server, PHP, and other required PHP extensions to your server. You can install all of them with the following command:

apt-get install -y nginx mariadb-server php php-cli php-fpm php-common php-mysql php-mbstring php-gd php-intl php-xml php-curl php-zip php-pgsql php-sqlite3 php-opcache php-apcu curl unzip wget -y

Once all the required packages are installed, open php.ini file and make required changes:

nano /etc/php/7.4/fpm/php.ini

Change the following lines:

memory_limit = 128M 
post_max_size = 16M 
upload_max_filesize = 16M 
date.timezone = Asia/Kolkata

Save and close the file. Then, start Nginx and MariaDB service and enable them to start after reboot with the following command:

systemctl start nginx
systemctl enable nginx
systemctl start mariadb
systemctl enable mariadb

Once you are done, you can proceed to the next step.

Configure Database for Roadiz

Next, you will need to create a database, database user and password for Roadiz.

To do so, log in to MariaDB shell with the following command:

mysql -u roo -p

Enter your root password then create a database and user for Roadiz with the following command:

MariaDB [(none)]> CREATE DATABASE roadizdb;
MariaDB [(none)]> GRANT ALL ON roadizdb.* TO 'roadiz' IDENTIFIED BY 'password';

Next, flush the privileges and exit from MariaDB shell with the following command:

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Once the database has been created, you can proceed to the next step.

Install Roadiz

First, you will need to download the latest version of Roadiz from the Git repository to Nginx document root directory. You can download it with the following command:

cd /var/www/html/
git clone https://github.com/roadiz/roadiz.git

Once the download is completed, change the directory to roadiz and open config.mysql.travis.yml file:

cd roadiz
nano conf/config.mysql.travis.yml

Make the following changes as per your database:

    driver: "pdo_mysql"
    host: "localhost"
    user: "roadiz"
    password: "password"
    dbname: "roadizdb"

Save and close the file, when you are finished.

Next, open the index.php file and define your IP address under AllowedIP section:

nano install.php

Add your IP address as shown below:

$allowedIp = [
    '10.0.2.2',     // vagrant host (forwarded)
    '192.168.33.1', // vagrant host (private)
    '127.0.0.1', 'fe80::1', '::1', ':ffff:127.0.0.1', '::ffff:127.0.0.1', 'YOUR-IP-ADDRESS'
];

Save and close the file. Then, you will need to install Composer to install the required PHP dependencies. You can install it with the following command:

curl -sS https://getcomposer.org/installer -o composer-setup.php php composer-setup.php --install-dir=/usr/local/bin --filename=composer

You should see the following output:

All settings correct for using Composer
Downloading...

Composer (version 1.8.6) successfully installed to: /usr/local/bin/composer
Use it: php /usr/local/bin/composer

Next, install all the required PHP dependencies with the following command:

composer install

Next, give proper permissions to the roadiz directory:

chown -R www-data:www-data /var/www/html/roadiz
chmod -R 755 /var/www/html/roadiz

Configure Nginx for Roadiz

Next, create an Nginx virtual host file for Roadiz. You can do it by creating roadiz.conf file in /etc/nginx/sites-available/ directory.

nano /etc/nginx/sites-available/roadiz.conf

Add the following lines:

server {
    listen 80;
    listen [::]:80;

    server_name example.com;             
    root /var/www/html/roadiz/;             

    index index.php;

    location / {
        try_files $uri $uri/ /index.php$is_args$args;
    }

    location ~ ^/(dev|install|preview|clear_cache)\.php(/|$) {
        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        fastcgi_param DOCUMENT_ROOT $realpath_root;
    }

    location ~ ^/index\.php(/|$) {
        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        fastcgi_param DOCUMENT_ROOT $realpath_root;
        internal;
     }
}

Save and close the file. Then, enable the virtual host file with the following command:

ln -s /etc/nginx/sites-available/roadiz.conf /etc/nginx/sites-enabled/

Next, test the Nginx for any syntax error with the following command:

nginx -t

Finally, restart Nginx and PHP-FPM service to apply all the configuration changes:

systemctl restart nginx
systemctl restart php7.4-fpm

Access Roadiz Dashboard

Now, open your web browser and type the URL http://example.com/install.php. You will be redirected to the following page:

Roadiz installation

Select your language and click on the Requirements. You should see the following page:

Requirements

Make sure all the required extensions are installed. Then, click on the Database button. You should see the following page:

Database settings

Next, provide your database details and click on the Build database button. You should see the following page:

Database installed

Next, click on the Theme button. You should see the following page:

Site information

Next, provide your site name, email address and click on the Save informations button. You should see the following page:

Theme setup

Next, click on the Perform theme install button. You should see the following page:

Import Theme content

Next, click on the User button to create an admin user. You should see the following page:

Create admin user

Next, provide your admin user details and click on the Create user button. You should see the following page:

user created

Next, click on the Done button. You should see the following page:

Roadiz successfully installed

Now, click on the Exit installation button. You should see the following page:

Success

Now, remove the install.php from Roadiz document root directory with the following command:

rm -rf /var/www/html/roadiz/install.php

Next, open your web browser and access your admin interface with the URL http://example.com/rz-admin. You will be redirected to the Roadiz login page:

Login to Roadiz

Provide your login details and click on the Log in button. You should see the Roadiz dashboard in the following page:

Roadiz Dashboard

Congratulations! you have successfully installed Roadiz on Debian 10 server. Feel free to ask me if you have any questions.

Share this page:

0 Comment(s)