Flarum on TLS Installation Guide [Ubuntu][Nginx]
#1
Purpose: This tutorial is designed to inform potential users of Flarum how to install it onto an Ubuntu VPS.

Fair warning: The developers of Flarum strongly advise against using it in a production environment, as it is still in early beta, and therefore many things are missing or not yet set in stone. Caveat Emptor.

Flarum is a relatively new, modern, mobile optimized forum script. This guide will show you how to install it onto an Ubuntu VPS running the nginx webserver and PHP 7.0.


In this guide, # will be used to preface commands that should be performed as superuser. $ indicates actions that can / should be performed as a regular user

Perparation

As with any software installation, you should begin by updating the package lists and upgrading installed packages to their latest version.

Code:
#apt-get update
#apt-get upgrade


Then make sure you have all dependencies installed. You need a webserver (we'll be using NGINX for this tutorial, but you can modify it for Apache 2), mysql, php, composer, unzip, and the following extensions for PHP:


Code:
1
2
3
4
5
6
7
8
php7.0-fpm
php7.0-curl
php7.0-readline
php7.0-xml
php7.0-json
php7.0-mbstring
php7.0-mysql
php7.0-cli

 
To install them all at once, enter the following command:

Code:
# apt-get install nginx composer mysql php7.0-fpm php7.0-curl php7.0-readline php7.0-xml php7.0-json php7.0-mbstring php7.0-mysql php7.0-cli zip

Set up your nginx configuration file for serving requests over TLS (not covered in this tutorial). Then navigate to the webroot you wish to install flarum on and run the following command:

Code:
composer create-project flarum/flarum . --stability=beta


This will begin the process of installing flarum on your server. Once it has completed, its time to make the database for it.
You can use whatever name you want for the user you create and the database you create, but make sure to note them down somewhere!

Code:
1
2
3
4
5
6
7
$ mysql --user='root'@'localhost' -p
Enter Password:
>CREATE USER 'flarum'@'localhost' IDENTIFIED BY password;
>CREATE DATABASE  flarum;
> USE flarum;
> GRANT ALL PRIVILEGES ON *.* TO 'flarum'@'localhost';
>EXIT


Now we have to grant the right permissions on flarum's files for it to work correctly.

Code:
# cd /path/to/your/webroot/
# chmod -R 755 .
# chown -R www-data:www-data .


Finally, add the following to your nginx config, under the TLS server{} block:

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
     gzip off; #fix for TLS vulnerability 
        index index.html index.htm index.php;

        location / { try_files $uri $uri/ /index.php?$query_string; }
        location /api { try_files $uri $uri/ /api.php?$query_string; }
        location /admin { try_files $uri $uri/ /admin.php?$query_string; }

        location /flarum {
                deny all;
                return 404;
        }

        location ~* \.php$ {
                fastcgi_split_path_info ^(.+.php)(/.+)$;
                fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_param HTTP_PROXY ""; # Fix for https://httpoxy.org/ vulnerability
                fastcgi_index index.php;
        }

        location ~* \.html$ {
                expires -1;
        }
        #Cache static files if possible
        location ~* \.(css|js|gif|jpe?g|png)$ {
                expires 1M;
                add_header Pragma public;
                add_header Cache-Control "public, must-revalidate, proxy-revalidate";
        }

and restart nginx:

Code:
# nginx -s reopen

Open your browser and navigate to your site. You should see a few boxes to fill out for the initial setup, including the SQL information. Fill it out and you are good to go!

Green text = speaking officially

Regular text = speaking as just another member
#2
I really don't recommend flarum for production use.

I broke my installation within the first 5 minutes of use.
And you should cache any static items for half an hour at least.

[Image: img.php?userid=19870&txt=1]

Thanks to FREEVPS.us  for VPS 14
A huge shoutout to @F7N for the steller cPanel Hosting
Follow me on Mastodon
View me on IRC @SlashNET
You can also Buy me coffee

[url=https://7ob.pw/FreeVPS/?userid=19870][/url]
#3
(2017-02-15, 9:05:55 pm)MichaelW Wrote: I really don't recommend flarum for production use.

I broke my installation within the first 5 minutes of use.
And you should cache any static items for half an hour at least.

It's been running well so far for me, albeit with a minor break when installing an extension (forgot to clear the server cache). Thanks for pointing out the caching, I'll get around to updating it eventually.
Green text = speaking officially

Regular text = speaking as just another member
#4
Hmm, i wanted to post a tutorial on this but you seem to beat me to it. By the way when installing flarum extension i recommend turning on the DEV mode so you can see the error message
Thanks to FreeVPS Hostigation for VPS 18 (x2)
#5
(2017-02-16, 11:28:32 am)Kotagami Wrote: Hmm, i wanted to post a tutorial on this but you seem to beat me to it. By the way when installing flarum extension i recommend turning on the DEV mode so you can see the error message

Dev mode is nice for debugging, but it puts extra load and makes logs harder to read. Just like with anything else, debug should only be turned on if you are experiencing issues.
Green text = speaking officially

Regular text = speaking as just another member
#6
(2017-02-16, 12:39:05 pm)Ignis Wrote: Dev mode is nice for debugging, but it puts extra load and makes logs harder to read. Just like with anything else, debug should only be turned on if you are experiencing issues.

Yea that's what i am saying, if the forum broke after installing an extension turn on dev mode so you can see the error. I also suggest switching to php7.1 instead of 7.0 just because its better and faster than 7.0
Thanks to FreeVPS Hostigation for VPS 18 (x2)
#7
(2017-07-21, 2:09:14 pm)Zubair Wrote: can you please make tutorial for installing nodebb or discourse Speechless

Not really familiar with nodebb. I thought about using discourse for a time, but it's an extremely heavy piece of software, and since it used docker, you can't run it on OVZ VPSes. Perhaps someday...
Green text = speaking officially

Regular text = speaking as just another member




Users browsing this thread: 1 Guest(s)

Switch to mobile version

Sponsors: Ftpit - ZXPlay - GalaxyHostPlus - Verelox- HostUS - HostMada - Host4Fun - Evolution-Host - NodeBlade - HostDare - VPSMost


BitCoin donations: 1DQxbstaTb5SWk6QC2gFeQUTFR64JX4cEo