Installing under sub-directory
1.) Initial setup
cd /var/www/domain
mkdir flarum && cd flarum
2.) https://flarum.org/docs/install.html#installing
composer create-project flarum/flarum . --stability=beta
./vendor/bin/upgrade-carbon
3.) https://flarum.org/docs/install.html#folder-ownership
cd .. && sudo chown -R www-data:www-data flarum
sudo chmod -R 0755 flarum && cd flarum
4.) https://flarum.org/docs/install.html#url-rewriting
sudo apache2ctl -M
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Loaded Modules:
core_module (static)
so_module (static)
watchdog_module (static)
http_module (static)
log_config_module (static)
logio_module (static)
version_module (static)
unixd_module (static)
access_compat_module (shared)
alias_module (shared)
auth_basic_module (shared)
authn_core_module (shared)
authn_file_module (shared)
authz_core_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
evasive20_module (shared)
expires_module (shared)
filter_module (shared)
headers_module (shared)
mime_module (shared)
mpm_prefork_module (shared)
negotiation_module (shared)
php7_module (shared)
reqtimeout_module (shared)
rewrite_module (shared)
security2_module (shared)
setenvif_module (shared)
socache_shmcb_module (shared)
ssl_module (shared)
status_module (shared)
unique_id_module (shared)
5.) https://flarum.org/docs/install.html#customizing-paths
sudo rsync -avzh public/* .
sudo rsync -avzh public/.* .
.htaccess
# Uncomment the following lines if you are not using a `public` directory
# to prevent sensitive resources from being exposed.
RewriteRule /\.git / [F,L]
RewriteRule ^composer\.(lock|json)$ / [F,L]
RewriteRule ^config.php$ / [F,L]
RewriteRule ^flarum$ / [F,L]
RewriteRule ^storage/(.*)?$ / [F,L]
RewriteRule ^vendor/(.*)?$ / [F,L]
.
.
.
<Directory "/var/www/domain/flarum">
AllowOverride All
</Directory>
index.php, flarum
require 'vendor/autoload.php';
$server = new Flarum\Http\Server(
Flarum\Foundation\Site::fromPaths([
'base' => __DIR__,
'public' => __DIR__,
'storage' => __DIR__.'/storage',
])
);
curl -v https://domain.com/flarum/admin
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
</body></html>
curl -v https://domain.com/flarum/login
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
</body></html>
config.php
<?php return array (
'debug' => false,
'database' =>
array (
'driver' => 'mysql',
'host' => 'localhost',
.
.
.
),
'url' => 'https://domain.com/flarum',
'paths' =>
array (
'api' => 'api',
'admin' => 'admin',
),
);