Passa al contenuto principale
Versione: 2.x

Installazione

Quick test drive?

Fatti un giro sul nostro forum di dimostrazione o sulla community verificata italiana Flarum.it. Oppure crea il tuo forum in pochi secondi su Free Flarum, un servizio gratuito non affiliato al team Flarum.

Requisiti del server​

Prima di installare Flarum, è importante verificare che il tuo server soddisfi i requisiti. Per eseguire Flarum, avrai bisogno di:

  • Apache (con mod_rewrite abilitato) o Nginx

  • PHP 8.3+ with the following extensions: curl, dom, fileinfo, gd, json, mbstring, openssl, tokenizer, zip, session

  • One of the following databases, with the PHP extension for it:

    • MySQL 5.7+ / 8.0.30+ (pdo_mysql)
    • MariaDB 10.3+ (pdo_mysql)
    • SQLite 3.35.0+ (pdo_sqlite)
    • PostgreSQL 10.0+ (pdo_pgsql)

    Before Flarum 2.0.2, the installer also asks for pdo_mysql whichever database you use.

  • SSH (command-line) access to run potentially necessary software maintenance commands, and Composer if you intend on using the command-line to install and manage Flarum extensions.

Recommended database versions

The versions above are the minimums Flarum supports, but older releases such as MySQL 5.7 and MariaDB 10.x are approaching (or past) their upstream end-of-life and are not recommended for new installs. For the best performance and longest support window, we recommend running a current LTS-grade release:

  • MySQL 8.4 LTS
  • MariaDB 11.8 LTS
  • PostgreSQL 15, 16, or 17

These are the versions Flarum is actively developed and tested against. Note that Flarum treats MySQL and MariaDB as distinct database drivers — make sure your config.php driver matches the server you're actually connecting to.

Installare Flarum​

Installing by unpacking an archive​

If you don't have SSH access to your server, or you prefer not to use the command line, you can install Flarum by unpacking an archive. Below is a list of the available archives, make sure you choose the one that matches your PHP version and public path or lack thereof preference.

Only the latest Flarum 2.x version is detailed here, for previous versions browse the archive

Flarum VersionPHP VersionPublic PathTypeArchive
2.0.28.5NoTAR.GZflarum-v2.0.2-no-public-dir-php8.5.tar.gz
2.0.28.5NoZIPflarum-v2.0.2-no-public-dir-php8.5.zip
2.0.28.5YesTAR.GZflarum-v2.0.2-php8.5.tar.gz
2.0.28.5YesZIPflarum-v2.0.2-php8.5.zip
2.0.28.4NoTAR.GZflarum-v2.0.2-no-public-dir-php8.4.tar.gz
2.0.28.4NoZIPflarum-v2.0.2-no-public-dir-php8.4.zip
2.0.28.4YesTAR.GZflarum-v2.0.2-php8.4.tar.gz
2.0.28.4YesZIPflarum-v2.0.2-php8.4.zip
2.0.28.3NoTAR.GZflarum-v2.0.2-no-public-dir-php8.3.tar.gz
2.0.28.3NoZIPflarum-v2.0.2-no-public-dir-php8.3.zip
2.0.28.3YesTAR.GZflarum-v2.0.2-php8.3.tar.gz
2.0.28.3YesZIPflarum-v2.0.2-php8.3.zip

Installing using the Command Line Interface​

Flarum usa Composer per gestire le sue dipendenze ed estensioni. Prima di installare Flarum, sar� necessario installare Composer sulla tua macchina. Successivamente, esegui questo comando in una cartella vuota in cui desideri installare Flarum:

composer create-project flarum/flarum:^2.0.0 .

Mentre questo comando è in esecuzione, puoi configurare il tuo server web. Dovrai assicurarti che il tuo webroot sia impostato su /percorso/del/tuo/forum/public, e impostare URL Rewriting come descritto qui sotto.

Quando tutto è pronto, accedi al tuo forum in un browser web e segui le istruzioni a video per completare l'installazione

If you wish to install and update extensions from the admin dashboard, you need to also install the Extension Manager extension.

composer require flarum/extension-manager:"*"
warning

The extension manager allows an admin user to install any composer package. Only install the extension manager if you trust all of your forum admins with such permissions.

Riscrittura URL​

Apache​

Flarum include un file .htaccess nella cartella public – assicurati che sia stato caricato correttamente. Flarum non funzionerà correttamente se mod_rewrite non è abilitato o il file .htaccess non è accessibile. Assicurati di verificare con il tuo provider di hosting (o il tuo VPS) che queste funzionalità siano abilitate. Se gestisci il tuo server, potresti dover aggiungere quanto segue alla configurazione del tuo sito per abilitare i file .htaccess.

<Directory "/percorso/di/flarum/public">
AllowOverride All
</Directory>

Ciò garantisce che gli override di htaccess siano consentiti in modo che Flarum possa riscrivere correttamente gli URL.

I metodi per abilitare mod_rewrite dipendono dal tuo OS. Puoi abilitarli eseguendo sudo a2enmod rewrite su Ubuntu. mod_rewrite è abilitato di default su CentOS. Non dimenticare di riavviare Apache dopo aver apportato modifiche!

Nginx​

Flarum include il file .nginx.conf – assicurati che sia caricato correttamente. Quindi, supponendo che tu abbia un sito PHP impostato all'interno di Nginx, aggiungi quanto segue al blocco di configurazione del tuo server:

include /path/to/flarum/.nginx.conf;

Caddy​

Caddy richiede una configurazione molto semplice affinché Flarum funzioni correttamente. Nota che devi sostituire l'URL con il tuo URL e il percorso con il tuo percorso della cartella public. Se stai usando una versione diversa di PHP, dovrai anche cambiare il percorso del file fastcgi per puntare al socket o all'URL di installazione PHP corretto.

www.example.com {
root * /var/www/flarum/public
php_fastcgi unix//var/run/php/php7.4-fpm.sock
header /assets/* {
+Cache-Control "public, must-revalidate, proxy-revalidate"
+Cache-Control "max-age=25000"
Pragma "public"
}
file_server
}

Proprietà della cartella​

Durante l'installazione, Flarum potrebbe richiedere di rendere scrivibili alcune directory. The user that Flarum is running as MUST have read + write access to: Modern operating systems are generally multi-user, meaning that the user you log in as is not the same as the user Flarum is running as.

  • The root install directory, so Flarum can edit config.php.
  • The storage subdirectory, so Flarum can edit logs and store cached data.
  • The assets subdirectory, so that logos and avatars can be uploaded to the filesystem.

Extensions might require other directories, so you might want to recursively grant write access to the entire Flarum root install directory.

There are several commands you'll need to run in order to set up file permissions. Please note that if your install doesn't show warnings after executing just some of these, you don't need to run the rest.

First, you'll need to allow write access to the directory. On Linux:

chmod 775 -R /path/to/directory

If that isn't enough, you may need to check that your files are owned by the correct group and user. If that isn't enough, you may need to check that your files are owned by the correct group and user. You'll need to look into the specifics of your distro and web server setup to make sure. You can change the folder ownership in most Linux operating systems by running:

chown -R www-data:www-data /path/to/directory

With www-data changed to something else if a different user/group is used for your web server.

Additionally, you'll need to ensure that your CLI user (the one you're logged into the terminal as) has ownership, so that you can install extensions and manage the Flarum installation via CLI. Additionally, you'll need to ensure that your CLI user (the one you're logged into the terminal as) has ownership, so that you can install extensions and manage the Flarum installation via CLI. You will likely need to log out and back in for this change to take effect.

Finally, if that doesn't work, you might need to configure SELinux to allow the web server to write to the directory. To do so, run:

chcon -R -t httpd_sys_rw_content_t /path/to/directory

To find out more about these commands as well as file permissions and ownership on Linux, read this tutorial. If you are setting up Flarum on Windows, you may find the answers to this Super User question useful.

Environments may vary

Your environment may vary from the documentation provided, please consult your web server configuration or web hosting provider for the proper user and group that PHP and the web server operate under.

Never use permission 777

You should never set any folder or file to permission level 777, as this permission level allows anyone to access the content of the folder and file regardless of user or group.

Personalizzare i percorsi​

By default Flarum's directory structure includes a public directory which contains only publicly-accessible files. This is a security best-practice, ensuring that all sensitive source code files are completely inaccessible from the web root.

However, if you wish to host Flarum in a subdirectory (like yoursite.com/forum), or if your host doesn't give you control over your webroot (you're stuck with something like public_html or htdocs), you can set up Flarum without the public directory.

If you intend to install Flarum using one of the archives, you can simply use the no-public-dir (Public Path = No) archives and skip the rest of this section. If you're installing via Composer, you'll need to follow the instructions below.

Simply move all the files inside the public directory (including .htaccess) into the directory you want to serve Flarum from. Then edit .htaccess and uncomment lines 9-15 in order to protect sensitive resources. For Nginx, uncomment lines 8-11 of .nginx.conf.

You will also need to edit the index.php file and change the following line:

$site = require './site.php';

Edit the site.php and update the paths in the following lines to reflect your new directory structure:

'base' => __DIR__,
'public' => __DIR__,
'storage' => __DIR__.'/storage',

Finally, check config.php and make sure the url value is correct.

Importazione dati da altro forum​

If you have an existing community and don't want to start from scratch, you may be able to import your existing data into Flarum. While there are no official importers yet, the community has made several unofficial importers:

These can be used for other forum software as well by migrating to phpBB first, then to Flarum. Be aware that we can't guarantee that these will work nor can we offer support for them.