Saltar al contenido principal
Version: 1.x

Instalación

Quick test drive?

No dude en probar Flarum en uno de nuestros foros de demostración. O bien, configure su propio foro en segundos en Free Flarum, un servicio comunitario gratuito no afiliado al equipo de Flarum.

Requisitos del Servidor​

Antes de instalar Flarum, es importante comprobar que tu servidor cumple los requisitos. Para ejecutar Flarum, necesitarás:

  • Apache (con mod_rewrite activado) o Nginx.
  • PHP 7.3+ with the following extensions: curl, dom, fileinfo, gd, json, mbstring, openssl, pdo_mysql, tokenizer, zip
  • MySQL 5.6+ o MariaDB 10.0.5+
  • 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.

PHP Configuration​

Flarum 1.x runs on PHP up to and including 8.5, but it is built on an older framework stack. On modern PHP, some of its dependencies emit deprecation notices. This is expected and does not affect how Flarum works.

Every PHP version that currently receives official support — 8.2, 8.3, 8.4 and 8.5 — is affected. In other words, if you are running Flarum 1.x on a PHP version that is still maintained (as you should be), you will encounter these notices, so the configuration below should be treated as a standard part of setting up Flarum 1.x.

Configure PHP to exclude deprecation warnings so they don't fill your logs or leak into responses:

error_reporting = E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED

On a typical production server display_errors is already off, so the notices are not shown to visitors — but they can still be written to your error log on every request, which the setting above prevents.

In practice we see the best results running Flarum 1.x on PHP 8.3, which at the time of writing still receives security support. If you have the choice, it is a good balance of stability and remaining support life for a 1.x install.

Consider upgrading to Flarum 2.x

These notices come from the older framework that Flarum 1.x is built on. That framework has itself reached end of life, so keeping 1.x running cleanly and securely on modern PHP takes progressively more effort over time.

Flarum 1.x is officially on life support while we finalize the 2.0 release. Going forward, the 1.x line will receive critical and security fixes only — no new features — and that support will wind down over time. We encourage all Flarum 1.x installations to plan an upgrade to Flarum 2.x, which is built on a current, supported framework and does not produce these deprecations.

Flarum 2.0 is in its release-candidate phase — the API is stable and many forums already run it in production — and a stable release is not far off. See the Flarum 2.x documentation to get started.

Instalando​

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.

flarum-v1.x-php7.4.zip

Flarum VersionPHP VersionPublic PathTypeArchive
1.8.198.5NoTAR.GZflarum-v1.x-no-public-dir-php8.0.tar.gz
1.8.198.5NoZIPflarum-v1.x-no-public-dir-php8.0.zip
1.8.198.5YesTAR.GZflarum-v1.x-php8.0.tar.gz
1.8.198.5YesZIPflarum-v1.x-php8.0.zip
1.8.198.4NoTAR.GZflarum-v1.x-no-public-dir-php8.3.tar.gz
1.8.198.4NoZIPflarum-v1.x-no-public-dir-php8.3.zip
1.8.198.4YesTAR.GZflarum-v1.x-php7.4.tar.gz
1.8.198.4YesZIPflarum-v1.x-php8.3.zip
1.8.198.3NoTAR.GZflarum-v1.x-no-public-dir-php7.3.tar.gz
1.8.198.3NoZIPflarum-v1.x-no-public-dir-php7.3.zip
1.8.198.3YesTAR.GZflarum-v1.x-php8.3.tar.gz
1.8.198.3YesZIPflarum-v1.x-php7.3.zip
1.8.198.2 (recommended)NoTAR.GZflarum-v1.x-no-public-dir-php8.2.tar.gz
1.8.198.2 (recommended)NoZIPflarum-v1.x-no-public-dir-php8.2.zip
1.8.198.2 (recommended)YesTAR.GZflarum-v1.x-php8.2.tar.gz
1.8.198.2 (recommended)YesZIPflarum-v1.x-php8.2.zip
1.8.198.1NoTAR.GZflarum-v1.x-no-public-dir-php8.1.tar.gz
1.8.198.1NoZIPflarum-v1.x-no-public-dir-php8.1.zip
1.8.198.1YesTAR.GZflarum-v1.x-php8.1.tar.gz
1.8.198.1YesZIPflarum-v1.x-php8.1.zip

Installing using the Command Line Interface​

Flarum utiliza Composer para gestionar sus dependencias y extensiones. Antes de instalar Flarum, necesitarás instalar Composer en tu máquina. Después, ejecuta este comando en una ubicación vacía en la que quieras que se instale Flarum:

composer create-project flarum/flarum:^1.8.0 .

Mientras se ejecuta este comando, puede configurar su servidor web. Tendrás que asegurarte de que tu webroot está configurado en /ruta/para/su/foro/public, y configurar el URL Rewriting según las instrucciones siguientes.

Cuando todo esté listo, navega a tu foro en un navegador web y sigue las instrucciones para completar la instalación.

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:"*"
aviso

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.

URL Rewriting​

Apache​

Flarum incluye un archivo .htaccess en el directorio public - asegúrese de que ha sido descargado correctamente. Flarum no funcionará correctamente si mod_rewrite no está habilitado o .htaccess no está permitido. Asegúrate de comprobar con tu proveedor de hosting (o tu VPS) que estas características están habilitadas. Si gestionas tu propio servidor, puede que tengas que añadir lo siguiente a la configuración de tu sitio para habilitar los archivos .htaccess:

<Directory "/ruta/para/flarum/public">
AllowOverride All
</Directory>

Esto asegura que las sobreescrituras de htaccess están permitidas para que Flarum pueda reescribir las URLs correctamente.

Los métodos para habilitar mod_rewrite varían dependiendo de su sistema operativo. Puedes activarlo ejecutando sudo a2enmod rewrite en Ubuntu. En CentOS está activado por defecto. No te olvides de reiniciar Apache después de hacer las modificaciones.

Nginx​

Flarum incluye un archivo .nginx.conf - asegúrate de que se ha descargado correctamente. Entonces, asumiendo que tienes un sitio PHP configurado dentro de Nginx, añade lo siguiente al bloque de configuración de tu servidor:

include /ruta/para/flarum/.nginx.conf;

Caddy​

Caddy requiere una configuración muy sencilla para que Flarum funcione correctamente. Tenga en cuenta que debe reemplazar la URL con la suya propia y la ruta con la ruta a su propia carpeta public. Si está usando una versión diferente de PHP, también necesitará cambiar la ruta fastcgi para que apunte a su socket o URL de instalación de PHP correcta.

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
}

Propiedad de la Carpeta​

Durante la instalación, Flarum puede solicitar que se permita la escritura en ciertos directorios. 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.

Personalización de las Rutas​

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.

Importar datos​

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.