Install Habari with Nginx on Debian 8

habariIn this tutorial we will cover the steps needed for installing Habari with Nginx on a Debian 8 VPS.

Habari is a free and open source blog engine written in PHP that currently supports MySQL, SQLite and PostgreSQL for the database backend. It is a publishing platform and application framework with a modular, object-oriented core.

An interesting fact is that the name Habari comes from the Swahili greeting habari which means “(what’s the) news”.

REQUIREMENTS

We will be using our SSD 1 Linux VPS hosting plan for this tutorial. This article assumes that you already have Nginx, MySQL and PHP installed and configured on your server. If that is not the case, you can follow our great tutorial and install the LEMP stack on your server easily.

LOG IN TO YOUR SERVER VIA SSH

# ssh root@server_ip

You can check whether you have the proper Debian version installed on your server with the following command:

# lsb_release -a

You should get this output:

Distributor ID: Debian
Description:    Debian GNU/Linux 8.3 (jessie)
Release:        8.3
Codename:       jessie

UPDATE THE SYSTEM

Make sure your server is fully up to date using:

# apt-get update && apt-get upgrade

You can now create a database that will be needed for the Habari installation. Log into MySQL as root and execute the following queries:

# mysql -u root -p

mysql> create database habari;
Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on habari.* to habariuser@localhost identified by 'your_password';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

INSTALL HABARI

Your next step is to download Habari and install it, configuring an Nginx virtual host directive for your domain along the way. First enter a directory of your choice where you will download the latest Habari version which at the moment of writing this article is version 0.9.2.

We will use the /opt directory but feel free to download Habari to a location of your choice.

# cd /opt

# wget http://habariproject.org/dist/habari-0.9.2.zip

Create a directory in which the unpacked installation will be moved:

# mkdir -p /var/www/html/habari

Unzip the archive into the above mentioned directory:

# unzip habari-0.9.2.zip -d /var/www/html/habari/

Assign the proper ownership of files and directories so your Nginx web server can actually read the data:

# chown -R www-data: /var/www/html/habari/

And last but not least, open a Nginx file, let’s call it habari which will serve as a virtual host for the domain you’ll use to host Habari.

# nano /etc/nginx/sites-available/habari

Paste the below lines into the file:

server {
    server_name domainname.com;

    access_log /var/log/nginx/domainname.com-access.log;
    error_log /var/log/nginx/domainname.com-error.log;
    root /var/www/html/habari;

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

    location ~ \.php$ {
        include /etc/nginx/fastcgi_params;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}

Of course, don’t forget to replace domainname.com with your actual domain. Save and close the file. Then, enable it by creating a symlink:

# ln -s /etc/nginx/sites-available/habari /etc/nginx/sites-enabled/

Test the Nginx configuration:

# nginx -t

If everything is successful, restart Nginx so the changes can take effect:

Need a fast and easy fix?
✔ Unlimited Managed Support
✔ Supports Your Software
✔ 2 CPU Cores
✔ 2 GB RAM
✔ 50 GB PCIe4 NVMe Disk
✔ 1854 GeekBench Score
✔ Unmetered Data Transfer
NVME 2 VPS

Now just $43 .99
/mo

GET YOUR VPS
# service nginx restart

Now open your favorite web browser and navigate to http://your_domain.com to finish the Habari installation.

Enter the database credentials under Database Setup and click on Check Database Connection to verify that the credentials are correct.

After that configure your site under Site Configuration in which you can name your Habari site, username, password and email.

Next, choose your theme, plugins and click on Install Habari to proceed.

Congratulations, you have successfully installed Habari with Nginx on your Debian 8 server.

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

Leave a Comment