Installing Bludit on Ubuntu 16.04

In this article, we will show you how to install Bludit on Ubuntu 16.04 VPS with PHP-FPM and Nginx. Bludit is a simple, fast and extensible open source file-based content management system (CMS) written in PHP. Bludit stores data in a flat file (in JSON format), so you don’t need to install or configure a database. With Bludit, you can easily and quickly create a fully functional website or blog in no time. This guide should work on other Linux VPS systems as well, but was tested and written for an Ubuntu 16.04 VPS.

Login to your VPS via SSH with SUDO user

ssh [email protected]_IP

Update the system and install the required packages

[destroyer]$ sudo apt-get update && sudo apt-get -y upgrade
[destroyer]$ sudo apt-get install nano wget unzip

Install PHP and required PHP modules To install the latest stable PHP version 7.0 and all required modules, run the command:

[destroyer]$ sudo apt-get -y install php-fpm php-cli php-json php-curl php-gd php-mysql php-mbstring php-xml

The following commands will set the PHP memory limit to 512MB, set fix_pathinfo to 0, change upload_max_filesize and post_max_size to 100M, and set the timezone to UTC.

sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/7.0/cli/php.ini
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/7.0/cli/php.ini
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php/7.0/fpm/php.ini
sed -i "s/upload_max_filesize = .*/upload_max_filesize = 100M/" /etc/php/7.0/fpm/php.ini
sed -i "s/post_max_size = .*/post_max_size = 100M/" /etc/php/7.0/fpm/php.ini

Create a new PHP-FPM pool for your user if you are not already one:

[destroyer]$ sudo nano /etc/php/7.0/fpm/pool.d/ваш_пользователь.conf
[ваш_пользователь]
destroyer = ваш_пользователь
group = ваш_пользователь
listen = /var/run/php/php7.0-ваш_пользователь-fpm.sock
listen.owner = ваш_пользователь
listen.group = ваш_пользователь
listen.mode = 0666
pm = ondemand
pm.max_children = 5
pm.process_idle_timeout = 10s
pm.max_requests = 200
chdir = /

Don’t forget to change your_user to your username. Restart PHP-FPM:

[destroyer]$ sudo service php7.0-fpm restart

Download Bludit

Download the latest Bludit from the Bludit website.

[destroyer]$ wget https://s3.amazonaws.ru/bludit-s3/bludit-builds/bludit_latest.zip
[destroyer]$ unzip bludit_latest.zip
[destroyer]$ mv bludit ~/myBludit.ru
[destroyer]$ rm -f bludit_latest.zip

Install and configure Nginx

To install the latest stable version of Nginx available on the Ubuntu repositories, run the following command:

[destroyer]$ sudo apt-get install nginx

Then create a new Nginx server block:

[destroyer]$ sudo nano /etc/nginx/sites-available/myBludit.ru
server {
    listen 80;
    server_name myBludit.ru;
    root /home/ваш_пользователь/myBludit.ru;
    index index.php;

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

    access_log  /var/log/nginx/myBludit.ru.access.log;
    error_log   /var/log/nginx/myBludit.ru.error.log;

    # Deny direct access to .txt files
    location ~* /bl-content/.*.txt$ { 
        return 404; 
    }

    location ~ .php$ {
        fastcgi_split_path_info ^(.+.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.0-ваш_пользователь-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
    }

    location ~ /.ht {
        deny all;
    }
}

Remember to change your_user to your username.

Activate the server block by creating a symbolic link:

[destroyer]$ sudo ln -s /etc/nginx/sites-available/myBludit.ru /etc/nginx/sites-enabled/myBludit.ru

Check your Nginx configuration and restart Nginx:

[destroyer]$ sudo nginx -t
[destroyer]$ sudo service nginx restart

Install Bludit

Open http://myBludit.ru/ in your favorite web browser and you should see the Bludit installation screen. On this page you need to enter the administrator information and click on the Install button.

That’s all. You have successfully installed Bludit on your Ubuntu 16.04 VPS. For more information on how to manage Bludit installation, please refer to the official Bludit documentation.

Sidebar