phpBB is a great open-source forum package written in PHP. It's easy to use, fairly easy to setup and contains very in-depth configuration and administration control panels (with very fine-grained permissions and other settings). Pretty much everything you would want in a forum / bb setup on your server.
This guide covers installing and setting up phpBB on a sub-domain (like https://forum.jaytaala.com) that points to an Apache reverse-proxy protected server.
Guide
Installing phpBB
phpBB runs on a LAMP server (Linux, Apache, MySQL/MariaDB, Php). I'm assuming your server/system is LAMP compliant - most distros are fairly similar for setting up as LAMP (here's a quick guide for Ubuntu Server).
See my guide here for setting up Apache for reverse-proxying.
Let's start by installing some PHP dependencies:
sudo apt-get install php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0 libapache2-mod-php7.0 php7.0-mcrypt php7.0-xmlrpc php7.0-gd
So, let's now install phpBB. Installing involves downloading and extracting the phpBB package to a folder and setting correct permissions.
Choose a folder (I'll use /var/www/phpbb
for this guide) that we'll download and extract phpBB to (note below I'm installing and downloading version 3.2.2, replace this with a link to the latest stable release from the phpBB download page):
cd /var/www sudo mkdir phpbb cd phpbb sudo wget https://www.phpbb.com/files/release/phpBB-3.2.2.zip sudo unzip phpBB-3.2.2.zip sudo rm phpBB-3.2.2.zip sudo mv phpBB3/* . sudo rm -rf phpBB3
Now, let's set proper ownership:
sudo chown -R www-data:www-data /var/www/phpbb
phpBB documentation gives the correct permissions. We'll set permissions accordingly. Note that config.php
should be set to 666
before installation (setup) and then to 644
after installation setup is done.
cd /var/www/phpbb find -type f | sudo xargs chmod 644 sudo chmod 666 config.php find -type d | sudo xargs chmod 755 sudo chmod 777 files/ cache/ store/ images/avatars/upload/
Preparing MySQL database for phpBB
Next we're going to create a database for phpBB to use, and a dedicated phpBB (MySQL) user.
You'll need to have already setup MySQL. See my guide on setting up MySQL for this.
Let's login to MySQL (as root) and create the db and user:
sudo mysql -uroot -p create database phpbb; create user 'phpbbuser'@'localhost' identified by '<ENTER_STRONG_PASSWORD_HERE>'; grant all privileges on phpbb.* to 'phpbbuser'@'localhost'; flush privileges; exit
Take note of the database name (phpbb) and MySQL user (phpbbuser) as you'll need it later when running the phpBB setup process.
Configuring Apache virtual host
Right, now let's go ahead an setup our reverse-proxy to the sub-domain we're planning on using (in my case I'm using https://forum.jaytaala.com and have already setup with my domain provider and pointed it to my servers ip address).
If you followed my Apache reverse proxy setup guide, then we will just need to add a virtual host for the new sub-domain:
<VirtualHost *:443> ServerName forum.jaytaala.com DocumentRoot /var/www/phpbb <Directory /var/www/phpbb> <IfModule mod_php5.c> php_flag register_globals off </IfModule> Options +FollowSymLinks AllowOverride All order allow,deny allow from all </Directory> # Your SSL certificate information for this sub-domain can go here. # If you use certbot-auto, it will automatically add it here if you use the --apache flag. # See the following 'LetsEncrypt for SSL certificates' section for details. </VirtualHost> <VirtualHost *:80> ServerName forum.jaytaala.com Redirect Permanent / https://forum.jaytaala.com/ </VirtualHost>
Once your virtual host is setup, reload (or restart) apache (note, depending on your distro, apache2
might need to be replaced with httpd
below):
sudo service apache2 reload
Setup phpBB
With the install done and apache2 now reverse-proxying, we should now be able to login and start the phpBB installer. Visit your phpBB (sub)domain with the /install
context, e.g. I would visit https://forum.jaytaala.com/install
You'll now need to setup through setup process. For the database server enter localhost
and the other details from the preceding Preparing MySQL database for phpBB section.
Clean-up
Once the install/setup process is completed, let's do some cleanup:
cd /var/www/phpbb sudo chmod 644 config.php sudo rm -rf install/
References
- https://www.linuxhelp.com/how-to-install-phpbb-on-ubuntu-16-04/
- https://www.phpbb.com/support/docs/en/3.0/kb/article/phpbb3-chmod-permissions/
- https://github.com/turnkeylinux-apps/phpbb/blob/master/overlay/etc/phpbb3/apache.conf
Related articles