Step-by-Step Guide: Installing phpBB Forum with Apache and Free Let’s Encrypt SSL on Ubuntu 22.04

phpBB is an open-source forum platform that empowers communities to communicate effectively online. Written in PHP with a MariaDB backend, phpBB boasts features like sub-forums, user groups, full-text search, plugins, and email notifications. It is highly scalable and customizable with an intuitive interface and easy-to-use management options.

This guide will walk you through the installation of phpBB using Apache and Let’s Encrypt SSL on Ubuntu 22.04.

Prerequisites

  • An Ubuntu 22.04 server.
  • A domain name linked to your server’s IP address.
  • Root access configured on the server.

Installing Apache, MariaDB, and PHP

Begin by installing the Apache web server, MariaDB database, PHP, and additional packages on your server using the command:

apt install apache2 mariadb-server php libapache2-mod-php php-gd php-curl openssl php-imagick php-intl php-json php-ldap php-common php-mbstring php-mysql php-imap php-sqlite3 php-net-ftp php-zip unzip php-pgsql php-ssh2 php-xml wget unzip -y

Start and enable the Apache service using the following commands:

systemctl start apache2
systemctl enable apache2

Creating a Database for phpBB

phpBB requires a database to function. Log in to the MariaDB shell:

mysql

Create the database and user for phpBB with the following commands:

MariaDB [(none)]> CREATE DATABASE phpdb;
MariaDB [(none)]> GRANT ALL ON phpdb.* to 'phpuser'@'localhost' IDENTIFIED BY 'password';

Flush the privileges and exit:

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Downloading phpBB

Download the latest phpBB version using:

wget https://download.phpbb.com/pub/release/3.3/3.3.7/phpBB-3.3.7.zip

Unzip and move the extracted files to Apache’s web root:

unzip phpBB-3.3.7.zip
mv phpBB3 /var/www/html/phpbb

Set appropriate ownership and permissions:

chown -R www-data:www-data /var/www/html/phpbb
chmod -R 775 /var/www/html/phpbb

Configuring Apache for phpBB

Create an Apache virtual host file with:

nano /etc/apache2/sites-available/phpbb.conf

Add the following configuration:

<VirtualHost *:80>
      ServerAdmin admin@example.com
      DocumentRoot /var/www/html/phpbb
      ServerName phpbb.example.com

      <Directory /var/www/html/phpbb>
                Options FollowSymlinks
                AllowOverride All
                Require all granted
       </Directory>

ErrorLog ${APACHE_LOG_DIR}/phpbb_error.log
CustomLog ${APACHE_LOG_DIR}/phpbb_access.log combined
</VirtualHost>

Enable the site and Apache modules, then restart Apache:

a2ensite phpbb
a2enmod rewrite
systemctl restart apache2

Accessing the phpBB Web Interface

Open your browser and navigate to http://phpbb.example.com to launch the installation process:

Securing phpBB with Let’s Encrypt SSL

Ensure your site’s security with Let’s Encrypt SSL. Install Certbot:

apt-get install python3-certbot-apache -y

Obtain and install your SSL certificate:

certbot --apache -d phpbb.example.com

Follow the prompts to complete the SSL setup:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator standalone, Installer None
Enter email address (used for urgent renewal and security notices): youremail@example.com

(A)gree/(C)ancel: A
Would you be willing to share your email address (Y)es/(N)o: Y
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for phpbb.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/phpbb-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/phpbb-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/phpbb-le-ssl.conf

Choose to redirect HTTP traffic to HTTPS:

Please choose whether to redirect HTTP traffic to HTTPS
1: No redirect - Make no further changes
2: Redirect - Make all requests redirect to HTTPS
Select [1-2]: 2

Conclusion

Congratulations! You’ve successfully installed phpBB with Apache and secured it with Let’s Encrypt SSL on Ubuntu 22.04. Begin exploring the control panel and creating your community board today.

Frequently Asked Questions

What is phpBB?

phpBB is an open-source forum software that offers robust features for creating and managing online community discussions.

Can phpBB be customized?

Yes, phpBB is highly customizable with numerous plugins and style options to create a tailored user experience.

Why is Let’s Encrypt SSL important?

Let’s Encrypt SSL helps secure data transferred between your server and users, increasing trust and improving website ranking.

How often should I renew my SSL certificate?

Let’s Encrypt SSL certificates are valid for 90 days. Renewal can be automated with Certbot’s “renew” command.