Before you install Flarum, it’s important to check that your server meets the requirements. To run Flarum, you will need:
1. Apache (with mod_rewrite enabled) or Nginx
2. PHP 7.1+ with the following extensions: curl, dom, gd, json, mbstring, openssl, pdo_mysql, tokenizer, zip
3. MySQL 5.6+ or MariaDB 10.0.5+
4. SSH (command-line) access to run Composer
使用下列指令安裝:
composer create-project flarum/flarum . --stability=beta
Apache
Flarum includes a .htaccess
file in the public
directory – make sure it has been uploaded correctly. If you’re using shared hosting, confirm with your provider that mod_rewrite
is enabled and .htaccess
files are allowed. If you’re managing your own server, you may need to add the following to your site configuration:
<Directory "/path/to/flarum/public">
AllowOverride All
</Directory>
Customizing Paths
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.
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-14 in order to protect sensitive resources. Finally, edit both index.php
and the flarum
executable, and update the paths in the following lines to reflect your new directory structure:
require 'vendor/autoload.php';
'base' => __DIR__,
'public' => __DIR__,
'storage' => __DIR__.'/storage',
That’s it. Access to the site for initial setup.
Referance: https://flarum.org/docs/install.html