How to Install Vanilla Forums with Apache and Let's Encrypt SSL on Ubuntu 20.04 LTS

Vanilla Forums is a free and open-source community forum software written in PHP. It is a simple, flexible, customizable and multi-lingual that provides all of the features you need to run a successful forum. It offers lots of add-ons, excellent integration options, and themes to choose from. It comes with a rich set of features including, Single-Sign On, Embeddable forums, Social media login, Import from other forums, Integrates with other FOSS projects and many more.

In this tutorial, we will learn how to install Vanilla Forum software with Apache and Let's Encrypt on Ubuntu 20.04.

Prerequisites

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

Install LAMP Server

First, you will need to install Apache web server, MariaDB, PHP and other required extensions in your system. You can install all of them with the following command:

apt-get install apache2 mariadb-server php7.4 libapache2-mod-php7.4 php7.4-common php7.4-mysql php7.4-cli php7.4-opcache php7.4-gd php7.4.intl php7.4-curl php7.4-cli php7.4-imap php7.4-mbstring php7.4-soap php7.4-xmlrpc php7.4-xml php7.4-zip unzip git wget -y

Once all the packages are installed, edit the php.ini and set some desired values:

nano /etc/php/7.4/apache2/php.ini

Change the following lines:

memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = America/Chicago

Save and close the file when you are finished.

Configure MariaDB Database

Next, secure the MariaDB installation and set the MariaDB root password using the following script:

mysql_secure_installation

You will be prompt for several questions as shown below:

Enter current password for root (enter for none): 
Set root password? [Y/n]: Y
New password: Enter password
Re-enter new password: Repeat 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

Once the MariaDB is secure, log in to the MariaDB with root user:

mysql -u root -p

Once login, create a database and user for Vanilla using the following command:

MariaDB [(none)]> CREATE DATABASE vanilladb;
MariaDB [(none)]> CREATE USER [email protected] IDENTIFIED BY 'password';

Next, grant all the privileges to the Vanilla database with the following command:

MariaDB [(none)]> GRANT ALL PRIVILEGES ON vanilladb.* TO [email protected];

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

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

At this point, your MariaDB database is configured for Vanilla.

Download Vanilla

First, you will need to download the latest version of Vanilla from their official website. At the time of writing this tutorial, the latest available version is Vanilla 3.3. You can download it with the following command:

wget https://open.vanillaforums.com/get/vanilla-core-3-3.zip

Once the download is completed, unzip the downloaded file using the following command:

unzip vanilla-core-3-3.zip

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

mv package /var/www/html/vanilla

Next, change the ownership of the vanilla directory to www-data and give proper permissions with the following command:

chown -R www-data:www-data /var/www/html/vanilla
chmod -R 755 /var/www/html/vanilla

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

Configure Apache for Vanilla Forum

Next, you will need to create a new Apache virtual host configuration file to serve Vanilla Forum.

You can create it with the following command:

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

Add the following lines:

<VirtualHost *:80>
     ServerAdmin [email protected]
     ServerName vanilla.linuxbuz.com
     DocumentRoot /var/www/html/vanilla/

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

     ErrorLog /var/log/apache2/vanilla_error.log
     CustomLog /var/log/apache2/vanilla_access.log combined

</VirtualHost>

Save and close the file when you are finished. Then, enable the virtual host file and restart the Apache service to implement the changes:

a2ensite vanilla.conf
systemctl reload apache2

You can also verify the Apache service status using the following command:

systemctl status apache2

You should 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 Thu 2020-06-25 07:42:29 UTC; 4min 35s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 16070 ExecReload=/usr/sbin/apachectl graceful (code=exited, status=0/SUCCESS)
   Main PID: 13697 (apache2)
      Tasks: 6 (limit: 2353)
     Memory: 23.5M
     CGroup: /system.slice/apache2.service
             ??13697 /usr/sbin/apache2 -k start
             ??16074 /usr/sbin/apache2 -k start
             ??16075 /usr/sbin/apache2 -k start
             ??16076 /usr/sbin/apache2 -k start
             ??16077 /usr/sbin/apache2 -k start
             ??16078 /usr/sbin/apache2 -k start

Jun 25 07:42:29 ubuntu20 systemd[1]: Starting The Apache HTTP Server...

At this point, the Apache webserver is configured to serve Vanilla Forum.

Secure Vanilla Forum with Let's Encrypt

You can also secure your Vanilla Forum website with Let's Encrypt SSL. Before starting, you will need to install the Certbot in your system. Certbot is a Let's Encrypt client used to install and manage Let's Encrypt SSL.

You can install the Certbot client by running the following command:

apt-get install certbot python3-certbot-apache -y

Once the Certbot is installed, run the following command to install the Let's Encrypt SSL for your website.

certbot --apache -d vanilla.linuxbuz.com

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

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): [email protected]

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for vanilla.linuxbuz.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/vanilla-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/vanilla-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/vanilla-le-ssl.conf

Next, you will also need to choose 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 domain:

Enabled Apache rewrite module
Redirecting vhost in /etc/apache2/sites-enabled/vanilla.conf to ssl vhost in /etc/apache2/sites-available/vanilla-le-ssl.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://vanilla.linuxbuz.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=vanilla.linuxbuz.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/vanilla.linuxbuz.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/vanilla.linuxbuz.com/privkey.pem
   Your cert will expire on 2020-09-23. 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"
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - 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

 - We were unable to subscribe you the EFF mailing list because your
   e-mail address appears to be invalid. You can try again later by
   visiting https://act.eff.org.

Now, your Vanilla Forum website is secured with Let's Encrypt SSL.

Access Vanilla Forum

Now, open your web browser and type the URL https://vanilla.linuxbuz.com. You should see the following screen:

Database settings

Forum settings

Provide your database details, application title, email, admin username, password and click on the Continue button. You should see the Vanilla dashboard in the following screen:

Vanilla Forum installed

Now, click on the VISIT SITE button. You should see the following screen:

Vanilla Forum on Ubuntu 20.04

Conclusion

Congratulations! you have successfully installed Vanilla Forum software with Apache and secure it with Let's Encrypt free SSL. You can now host your own community forum within a minute. Feel free to ask me if you have any questions.

Share this page:

Suggested articles

0 Comment(s)

Add comment