Step-by-Step Guide: Installing MyBB Forum with Nginx and Let’s Encrypt on Debian 10

MyBB is a robust and flexible open-source forum program, renowned for its intuitive interface. With hundreds of plugins and themes available, extending its features or transforming its appearance is a breeze.

In this guide, you’ll learn how to install and configure the MyBB forum software on a Debian 10 (buster) system.

Requirements

Ensure your system meets the following requirements for MyBB 1.8 and the Merge System 1.8:

  • PHP version 5.2 or higher (PHP 7.3 is recommended).
  • Database Options:
    • MySQL 5.0 or newer, PostgreSQL 8.1 or newer, SQLite 3 or newer.
      Recommendation: PostgreSQL 10.0 or MySQL 8.0.
  • Web Server: Apache, Nginx, Lighttpd, or IIS.
  • PHP Extensions needed:
    • SimpleXML
    • mbstring
    • gd
    • Database-specific PHP extensions

NOTE: Remember to replace example.com with your own domain name.

Prerequisites

  • A Debian 10 (buster) operating system.
  • A non-root user with sudo privileges.

Initial Steps

Verify your Debian version:

lsb_release -ds
# Debian GNU/Linux 10 (buster)

Configure the timezone:

sudo dpkg-reconfigure tzdata

Update your system packages to ensure you have the latest security patches and updates:

sudo apt update && sudo apt upgrade -y

Install essential packages for Debian administration:

sudo apt install -y curl wget vim git unzip socat bash-completion apt-transport-https

Step 1 – Install PHP and Required PHP Extensions

Install PHP along with the necessary extensions:

sudo apt install -y php php-cli php-fpm php-gd php-mbstring php-xml php-mysql php-pgsql

View PHP compiled modules:

php -m
# Output includes: ctype, curl, exif, fileinfo, etc.

Check the PHP version:

php --version
# Sample Output:
# PHP 7.3.9-1~deb10u1 (cli) (built: Sep 18 2019 10:33:23) ( NTS )
# Copyright (c) 1997-2018 The PHP Group
# Zend Engine v3.3.9, Copyright (c) 1998-2018 Zend Technologies
# with Zend OPcache v7.3.4-2, Copyright (c) 1999-2018, by Zend Technologies

PHP-FPM automatically starts on Debian 10; move to the next step.

Step 2 – Install acme.sh Client and Obtain Let’s Encrypt Certificate (Optional)

While not mandatory, securing your forum with HTTPS improves security. Use acme.sh, a simple shell script, to obtain a TLS certificate from Let’s Encrypt.

Install acme.sh:

sudo su - root
git clone https://github.com/Neilpang/acme.sh.git
cd acme.sh
./acme.sh --install --accountemail your_email@example.com
source ~/.bashrc
cd ~

Verify acme.sh version:

acme.sh --version
# v2.8.2

Acquire RSA and ECC/ECDSA certificates for your domain/hostname:

# RSA 2048
acme.sh --issue --standalone -d example.com --keylength 2048
# ECDSA
acme.sh --issue --standalone -d example.com --keylength ec-256

For test certificates, include the --staging flag.

After executing the commands, your certificates and keys are available at:

  • RSA: /home/username/example.com
  • ECC/ECDSA: /home/username/example.com_ecc

List issued certificates:

acme.sh --list

Create a directory to store your certificates:

mkdir -p /etc/letsencrypt/example.com
sudo mkdir -p /etc/letsencrypt/example.com_ecc

Install/copy certificates to /etc/letsencrypt directory:

# RSA
acme.sh --install-cert -d example.com --cert-file /etc/letsencrypt/example.com/cert.pem --key-file /etc/letsencrypt/example.com/private.key --fullchain-file /etc/letsencrypt/example.com/fullchain.pem --reloadcmd "sudo systemctl reload nginx.service"
# ECC/ECDSA
acme.sh --install-cert -d example.com --ecc --cert-file /etc/letsencrypt/example.com_ecc/cert.pem --key-file /etc/letsencrypt/example.com_ecc/private.key --fullchain-file /etc/letsencrypt/example.com_ecc/fullchain.pem --reloadcmd "sudo systemctl reload nginx.service"

Certificates automatically renew every 60 days. Exit root:

exit

Step 3 – Install MariaDB and Create a Database for MyBB

Install the MariaDB server:

sudo apt install -y mariadb-server

Check MariaDB version:

mysql --version
# mysql Ver 15.1 Distrib 10.3.17-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

Secure MariaDB by running the security script. Set a password for the root user:

sudo mysql_secure_installation

Response to prompts:

Would you like to setup VALIDATE PASSWORD plugin? N
New password: your_secure_password
Re-enter new password: your_secure_password
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

Access MariaDB as root and create an empty database and user for MyBB:

sudo mysql -u root -p
# Enter password
mariadb> CREATE DATABASE dbname;
mariadb> GRANT ALL ON dbname.* TO 'username' IDENTIFIED BY 'password';
mariadb> FLUSH PRIVILEGES;
mariadb> exit

Replace dbname, username, and password with your specifics.

Step 4 – Install and Configure Nginx

Install Nginx from the Debian repository:

sudo apt install -y nginx

Verify Nginx version:

sudo nginx -v
# nginx version: nginx/1.14.2

Configure Nginx by creating a new configuration file:

sudo vim /etc/nginx/sites-available/mybb.conf

Insert the following configuration:

server {
  listen 80;
  listen 443 ssl;

  ssl_certificate /etc/letsencrypt/example.com/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/example.com/private.key;
  ssl_certificate /etc/letsencrypt/example.com_ecc/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/example.com_ecc/private.key;

  server_name forum.example.com;

  root /var/www/mybb;

  location / {
    index index.php;
  }

  # Deny access to internal files.
  location ~ /(inc|uploads/avatars) {
    deny all;
  }

  location ~ \.php$ {
    fastcgi_pass unix:/run/php/php7.3-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
  }

}

Activate the new configuration by linking it to the sites-enabled directory:

sudo ln -s /etc/nginx/sites-available/mybb.conf /etc/nginx/sites-enabled/

Verify and reload Nginx configuration:

sudo nginx -t
sudo systemctl reload nginx.service

Step 5 – Install MyBB

Create the document root directory:

sudo mkdir -p /var/www/mybb

Download and unzip MyBB:

cd /var/www/mybb
sudo wget https://resources.mybb.com/downloads/mybb_1821.zip
sudo unzip mybb_1821.zip
sudo mv /var/www/mybb/Upload/* /var/www/mybb

Remove unnecessary files:

sudo rm mybb_1821.zip
sudo rmdir Upload

Adjust file permissions:

sudo chown -R www-data:www-data /var/www/mybb

Complete the installation by visiting http://example.com/install. For admin access, use /admin. Remove the installation directory after the setup:

sudo rm -rf /var/www/mybb/install/

Step 6 – Complete the MyBB Setup

Open the MyBB installation wizard in your web browser:

Click “Next” on the welcome page:

MyBB Installation Wizard

Review and accept the MyBB license:

MyBB License

Ensure your server meets requirements and click “Next”:

Check Requirements

Configure the database and proceed by clicking “Next”:

Database configuration

Insert database tables by proceeding with “Next”:

Creating database tables

Populate database tables with default data, click “Next”:

Populate tables

Load theme data into the forum by clicking “Next”:

Add Theme

Configure basic board settings:

Basic Board configuration

Create a MyBB administrator account:

Create administrator account

Upon successful completion, you will see the “Finish Setup” page:

Finish the setup

Access the admin interface by appending /admin to your URL:

MyBB Login

Your MyBB admin interface should look like this:

MyBB Forum

Here is a screenshot of the MyBB frontend:

MyBB frontend

Congratulations! Your MyBB forum is successfully installed.

Links

FAQ

What is MyBB?

MyBB is a free, open-source forum software that is easy to use, highly configurable, and comes with a wide range of plugins and themes.

Why should I secure my MyBB forum with HTTPS?

Securing your forum with HTTPS helps keep user data secure and improves trust, especially when personal information or authentication details are involved.

Which database is recommended for MyBB?

PostgreSQL 10.0 or MySQL 8.0 are highly recommended, although older versions are compatible.

How do I access the MyBB admin panel?

To access the MyBB admin panel, append /admin to the URL of your MyBB site.

Can I automate Certificate Renewals?

Yes, the acme.sh client is configured to renew certificates automatically every 60 days.