Table des matières

Installer flarum

Flarum est un moteur de forums web.

Jail

Préparez une jail, nommée flarum. C'est une application PHP, suivez la documentation à ce sujet.

Installation

Installez votre environnement php:

pkg -j flarum install php83 databases/php83-pdo_mysql devel/php83-tokenizer archivers/php83-zip converters/php83-mbstring ftp/php83-curl graphics/php83-gd sysutils/php83-fileinfo textproc/php83-dom www/php83-session

Puis la base de donnée:

pkg install -j flarum mariadb106-server mariadb106-client
sysrc -j flarum mysql_enable="yes"

et l'installeur php composer:

pkg -j flarum install php-composer archivers/php83-phar

Base de donnée

Entrez à l’intérieur de la jail:

root@popeye:# jexec flarum

Finissez l'installation de mariadb:

root@flarum:# mysql_secure_installation

Créez la base:

root@flarum:# mysql -u root -p
# Enter password:
CREATE DATABASE flarum;
CREATE USER 'patron'@'192.168.0.x' IDENTIFIED BY 'flarum_pass';
GRANT ALL PRIVILEGES ON flarum.* TO 'patron'@'192.168.0.x';
FLUSH PRIVILEGES;
exit;
Notez que vous devez associer votre utilisateur à l'adresse de la jail, ou de la jail qui fait tourner mariadb, le cas échéant.

Flarum

Installez le logiciel composer pour simplifier l'installation:

root@flarum:# composer install

Puis le logiciel lui-même:

root@flarum:# mkdir -p /usr/local/www/flarum
root@flarum:# chown -R www:www /usr/local/www/flarum
root@flarum:# cd /usr/local/www/flarum
root@flarum:# composer create-project flarum/flarum . --stability=beta
root@flarum:# chown -R www:www /usr/local/www/flarum

Nginx

Après avoir configuré votre nom de domaine et installé des clefs https, configurez le serveur web comme suit:

  server {
                http2 on;
                listen [::]:443 ssl;
                listen 443 ssl;
                server_name flarum.lapinbilly.eu ;
                root /jails/flarum/usr/local/www/flarum/public;
                index index.php;
                ssl_certificate /usr/local/etc/letsencrypt/live/flarum.lapinbilly.eu/fullchain.pem;
                ssl_certificate_key /usr/local/etc/letsencrypt/live/flarum.lapinbilly.eu/privkey.pem;
                keepalive_requests    10;
                keepalive_timeout     60 60;
                client_max_body_size 15M;
                client_body_buffer_size 128k;
                location / {
                        try_files $uri $uri/ /index.php?$query_string;
                }
 
                location ~ \.php$ {
                        try_files $uri $uri/ /doku.php;
                        fastcgi_pass unix:/jails/flarum/var/run/php-fpm.sock;
                        fastcgi_param REDIRECT_STATUS 200;
                        include fastcgi_params;
                        fastcgi_index index.php;
                        fastcgi_param SCRIPT_FILENAME /usr/local/www/flarum/public/$fastcgi_script_name;
                        fastcgi_param  QUERY_STRING     $query_string;
                        fastcgi_param  REQUEST_METHOD   $request_method;
                        fastcgi_param  CONTENT_TYPE     $content_type;
                        fastcgi_param  CONTENT_LENGTH   $content_length;
                        fastcgi_intercept_errors        on;
                        fastcgi_ignore_client_abort     off;
                        fastcgi_connect_timeout 60;
                        fastcgi_send_timeout 180;
                        fastcgi_read_timeout 180;
                        fastcgi_buffer_size 128k;
                        fastcgi_buffers 4 256k;
                        fastcgi_busy_buffers_size 256k;
                        fastcgi_temp_file_write_size 256k;
                }
# Block access to .htaccess files
                location ~ /\.ht {
                        deny  all;
                }
        }