How to install AsmBB on VPS with Nginx and systemd

Recently I migrated the whole my domain asm32.info on a new hosting - cheap $5 a month VPS from Vultr.

The migration was because of some bugs in Apache http2 module on my previous hosting provider that have broke the server sent events on the real time chat of AsmBB. As long as I was on a shared hosting, it was impossible to control the Apache settings, so I decided to take control in my hands.

Anyway, during the migration, I installed Nginx as a web server and in this post will explain how to setup AsmBB on this setting.

Prerequisites

For this tutorial I am assuming you have:

Some Linux admin skills. You should be able to install packages and to setup a web server (at least following the countless tutorials on the Internet).

Working GNU/Linux distribution with systemd. Of course any other distro will work, but you will need to setup the startup of AsmBB by yourself.

Installed Nginx web server. I will explain only how to integrate AsmBB.

Installing AsmBB

Download the recent binary package from the permanent link: asmbb.tar.gz

Create a new directory, where the forum sub-domain will stay. I will name it /PATH/TO/FORUM/ . Put the downloaded file inside.

Untar with the following commands:

$ tar -xvzf asmbb.tar.gz $ mv asmbb/* ./ $ rm -rf asmbb/

After the unpack, there are some unneeded files, like text files and example config files in the directory. You can safely delete them. Only the subdirectories and 3 executable files are required. Notice that the subdirectories may contain some important symlinks, so unpacking on local computer and then uploading through FTP will not work (because FTP can't copy symlinks).

All the files and the directory must be owned by some non-root user that will run AsmBB later. I will name it NON_ROOT .

Nginx configuration

Insert in the nginx config file (in /etc/nginx/nginx.cong or in the forum sub-domain configuration file) the following:

server { ..... # Your subdomain server configuration. # Should contains at least "listen" and "server_name" nginx options. root /PATH/TO/FORUM/; location / { fastcgi_pass unix:/PATH/TO/FORUM/engine.sock; include fastcgi_params; } }

Don't forget to replace the placeholders!

Restart Nginx:

sudo systemctl restart nginx

Systemd configuration

Now configure systemd service that to manage AsmBB engine.

Will need root access here. Create as a root the file /etc/systemd/system/asmbb.service with the following text (of course replace the placeholders /PATH/TO/FORUM and NON_ROOT :

[Unit] Description=AsmBB forum engine FastCGI script. After=nginx.service [Service] Type=simple User=NON_ROOT WorkingDirectory=/PATH/TO/FORUM ExecStart=/PATH/TO/FORUM/engine Restart=on-failure [Install] WantedBy=nginx.service

Finalizing

You just finished the configuration.

Now you can open the forum sub-domain in your browser. You should get 502 bad gateway error, because AsmBB is still not running.

Now start AsmBB:

sudo systemctl start asmbb

Refresh the browser. The admin setup dialog of AsmBB should appear. Setup your admin user and the forum should start working in regular mode.

If everything is OK until now, let's make the startup of AsmBB automatic on server restart:

sudo systemctl enable asmbb

That is all. You now have working, blazingly fast web forum that can handle hundreds of users and million posts with very low system resources.

Login as an administrator and adjust the settings of the forum to your preferences.