How to Install phpBB Forum with Apache and free Let’s Encrypt SSL on Ubuntu 22.04

ComputingPost
5 min readJan 10, 2023

--

phpBB is free and open-source forum software that provides a space for people to gather and communicate with each other. It is written in PHP and uses MariaDB as a database backend. It offers a rich set of features, including sub-forums, user groups, full-text search, plugins, and email notifications. It is fully scalable, and customizable, and has a user-friendly interface and straightforward management options.

This post will show you how to install phpBB with Apache and Let’s Encrypt SSL on Ubuntu 22.04.

Prerequisites

  • A server running Ubuntu 22.04.
  • A valid domain name pointed with your server IP.
  • A root password is configured on the server.

Install Apache, MariaDB, and PHP

First, you will need to install the Apache webserver, MariaDB database server, PHP and other packages to your server. You can install all of them by running the following 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

Once all the packages are installed, start and enable the Apache service with the following command:

systemctl start apache2

systemctl enable apache2

Create a Database for phpBB

phpBB uses a MariaDB to store their data. So you will need to create a database and user for phpBB. First, log in to the MariaDB shell with the following command:

mysql

Once you are logged in, create a database and user with the following command:

MariaDB [(none)]> CREATE DATABASE phpdb;

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

Next, flush the privileges and exit from the MariaDB with the following command:

MariaDB [(none)]> FLUSH PRIVILEGES;

MariaDB [(none)]> EXIT;

Once you are done, you can proceed to the next step.

Download phpBB

Next, you will need to download the latest version of phpBB from their official download page. You can download it with the following command:

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

Once the phpBB is downloaded, unzip the downloaded file with the following command:

unzip phpBB-3.3.7.zip

Next, move the extracted directory to the Apache web root directory:

mv phpBB3 /var/www/html/phpbb

Next, change the ownership and permission of the phpbb directory:

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

chmod -R 775 /var/www/html/phpbb

Once you are done, you can proceed to the next step.

Configure Apache for phpBB

Next, you must create an Apache virtual host configuration file to host phpBB. You can create it with the following command:

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

Add the following lines:

ServerAdmin admin@example.com

DocumentRoot /var/www/html/phpbb

ServerName phpbb.example.com





Options FollowSymlinks

AllowOverride All

Require all granted





ErrorLog $APACHE_LOG_DIR/phpbb_error.log

CustomLog $APACHE_LOG_DIR/phpbb_access.log combined

Save and close the file when you are finished then enable the Apache virtual host and rewrite module with the following command:

a2ensite phpbb

a2enmod rewrite

Next, restart the Apache service to apply the changes:

systemctl restart apache2

You can also check the status of the Apache service using the following command:

systemctl status apache2

You will get the following output:

? apache2.service - The Apache HTTP Server

Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)

Active: active (running) since Sat 2022-05-28 10:50:04 UTC; 2s ago

Docs: https://httpd.apache.org/docs/2.4/

Process: 22212 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)

Main PID: 22217 (apache2)

Tasks: 6 (limit: 2292)

Memory: 15.8M

CPU: 98ms

CGroup: /system.slice/apache2.service

??22217 /usr/sbin/apache2 -k start

??22218 /usr/sbin/apache2 -k start

??22219 /usr/sbin/apache2 -k start

??22220 /usr/sbin/apache2 -k start

??22221 /usr/sbin/apache2 -k start

??22222 /usr/sbin/apache2 -k start



May 28 10:50:04 ubuntu2204 systemd[1]: Starting The Apache HTTP Server...

Access phpBB Web Interface

Now, open your web browser and access the phpBB web interface using the URL http://phpbb.example.com. You should see the following page:

Click on the INSTALL tab and click on the Install button to start the installation. You should see the following page:

Provide your admin username, password, and click on the Submit button. You should see the following page:

Provide your database host, port, database name, username, password, and click on the Submit button. You should see the following page:

Provide your protocol, website domain name, port, path, and click on the Submit button. You should see the following page:

Provide your SMTP details and click on the Submit button. You should see the following page:

Select your language, board name, board description and click on the Submit button. You should see the following page:

Click on the Take me to the ACP button. You should see the phpBB control panel on the following page:

Secure phpBB with Let’s Encrypt SSL

It is always a good idea to secure your website with Let’s Encrypt SSL. You will need to install the Certbot client to install and manage the SSL. You can install it with the following command:

apt-get install python3-certbot-apache -y

Once the Certbot is installed, run the following command to secure your website with Let’s Encrypt SSL:

certbot --apache -d phpbb.example.com

You will be asked to provide your email and accept the term of service as shown below:

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) (Enter 'c' to

cancel): haifa.shafeq@gmail.com



- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Please read the Terms of Service at

https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must

agree in order to register with the ACME server at

https://acme-v02.api.letsencrypt.org/directory

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

(A)gree/(C)ancel: A



- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Would you be willing to share your email address with the Electronic Frontier

Foundation, a founding partner of the Let's Encrypt project and the non-profit

organization that develops Certbot? We'd like to send you email about our work

encrypting the web, EFF news, campaigns, and ways to support digital freedom.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

(Y)es/(N)o: Y

Plugins selected: Authenticator apache, Installer apache

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

Next, select whether or not to redirect HTTP traffic to HTTPS as shown below:

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

1: No redirect - Make no further changes to the webserver configuration.

2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for

new sites, or if you're confident your site works on HTTPS. You can undo this

change by editing your web server's configuration.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

Type 2 and hit Enter to install the Let’s Encrypt SSL for your website:

Enabled Apache rewrite module

Redirecting vhost in /etc/apache2/sites-enabled/phpbb.conf to ssl vhost in /etc/apache2/sites-available/phpbb-le-ssl.conf



- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Congratulations! You have successfully enabled https://phpbb.example.com



You should test your configuration at:

https://www.ssllabs.com/ssltest/analyze.html?d=phpbb.example.com

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



IMPORTANT NOTES:

- Congratulations! Your certificate and chain have been saved at:

/etc/letsencrypt/live/phpbb.example.com/fullchain.pem

Your key file has been saved at:

/etc/letsencrypt/live/phpbb.example.com/privkey.pem

Your cert will expire on 2022-08-12. To obtain a new or tweaked

version of this certificate in the future, simply run certbot again

with the "certonly" option. To non-interactively renew *all* of

your certificates, run "certbot renew"

- If you like Certbot, please consider supporting our work by:



Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate

Donating to EFF: https://eff.org/donate-le

Now, you can access your website securely using the URL https://phpbb.example.com.

Conclusion

Congratulations! you have successfully installed phpBB with Apache and Let’s Encrypt SSL on Ubuntu 22.04. You can now explore the phpBB control panel and start creating your first board.

https://www.computingpost.com/how-to-install-phpbb-forum-with-apache-and-free-lets-encrypt-ssl-on-ubuntu-22-04/?feed_id=25455&_unique_id=63bd8f2c39748

--

--

ComputingPost

ComputingPost — Linux Howtos, Tutorials, Guides, News, Tips and Tricks.