Install FluxBB on a CentOS 7 VPS with Nginx and PHP-FPM

install-fluxbb-on-a-centos-7-vps-with-nginx-and-php-fpmIn this tutorial, we will show you how to install FluxBB on a CentOS 7 VPS with Nginx, MariaDB and PHP-FPM. FluxBB is blazing fast and open source forum application written in PHP. Some of the main features of FluxBB are: clean admin interface, flexible permission system, easy to use, blazing fast speed and powerful moderator tools. This guide should work on other Linux VPS systems as well but was tested and written for a CentOS 7 VPS.

Update the system and install the necessary packages.

root@vps:~# yum -y update
root@vps:~# yum install unzip wget

Install MariaDB and create a database.

To install a MariaDB server run the following command:

root@vps:~# yum install mariadb-server mariadb

start the service and enable it at boot time:

root@vps:~# systemctl start mariadb.service
root@vps:~# systemctl enable mariadb.service

It is very important to secure your MariaDB server, run the following script before creating and populating the databases.

mysql_secure_installation

Once you are finished with the step above, login as the MariaDB root user and create a new database and user:

root@vps:~# mysql -uroot -p
MariaDB [(none)]>> create database fluxbb;
MariaDB [(none)]>> GRANT ALL PRIVILEGES ON fluxbb.* TO 'fluxbb'@'localhost' IDENTIFIED BY 'fluxbbPassword';
MariaDB [(none)]>> flush privileges;
MariaDB [(none)]>> \q;

Download and unzip FluxBB

At the time of this writing the latest stable version of FluxBB is version 1.5.7. The following commands will create a root directory for your forum and download and extract the FluxBB zip file.

root@vps:~# mkdir -p /var/www/html/myForum.org/
root@vps:~# cd /var/www/html/myForum.org/
root@vps:~# wget http://fluxbb.org/download/releases/1.5.7/fluxbb-1.5.7.zip
root@vps:~# unzip fluxbb-1.5.7.zip
root@vps:~# mv fluxbb-1.5.7/* .
root@vps:~# rm -rf fluxbb-1.5.7*

Install and configure PHP and Nginx

Installing PHP and Nginx is pretty easy, just run the following command:

root@vps:~# yum install nginx php-fpm php-cli php-mysqlnd php-mbstring php-gd php-curl php-pdo
root@vps:~# systemctl start php-fpm.service
root@vps:~# systemctl enable php-fpm.service
root@vps:~# systemctl start nginx.service 
root@vps:~# systemctl enable nginx.service

To change PHP-FPM to listen on a unix socket, open the default www pool

root@vps:~# vim /etc/php-fpm.d/www.conf

and change from

listen = 127.0.0.1:9000

to

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
listen = /var/run/php-fpm/php-fpm.socket

and restart the service for changes to take effect

root@vps:~# systemctl restart php-fpm

Create a php session directory and change the ownership to apache (the user under which PHP runs).

root@vps:~# mkdir /var/lib/php/session
root@vps:~# chown apache:apache /var/lib/php/session

Create a new Nginx server block with the following content:

root@vps:~# cat <<'EOF' >> /etc/nginx/conf.d/myForum.org.conf
server {
    server_name myForum.org;
    listen 80;
    root /var/www/html/myForum.org;
    access_log /var/log/nginx/myForum.org-access.log;
    error_log /var/log/nginx/myForum.org-error.log;
    index index.php;
 
    location / {
        try_files $uri $uri/ /rewrite.php?$args;
    }

    location ~ /(cache|include|lang|plugins) {
       deny all;
       return 403;
    }

    location ~ \.php$ {
        fastcgi_index index.php;
        fastcgi_split_path_info ^(.+\.php)(.*)$;
        fastcgi_keep_conn on;
        include /etc/nginx/fastcgi_params;
        fastcgi_pass unix:/var/run/php-fpm/php-fpm.socket;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
 
    location ~ /\.ht {
        deny all;
    }

}
EOF

Test the Nginx configuration and restart the server by running the following commands:

root@vps:~# nginx -t

root@vps:~#  systemctl restart nginx

Set the correct permissions

root@vps:~# chown -R apache:apache /var/www/html/myForum.org/

That’s it. Now open your browser, go to http://myForum.org/install.php and follow the FluxBB installation wizard.


 

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 set this up 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