Skip to content

Instantly share code, notes, and snippets.

@paulc
Last active January 23, 2021 17:10
Show Gist options
  • Save paulc/090e30e1b3b0ea87237925d8a9f0ef75 to your computer and use it in GitHub Desktop.
Save paulc/090e30e1b3b0ea87237925d8a9f0ef75 to your computer and use it in GitHub Desktop.
FreeBSD 12.2 FLARUM
<host> {
root * /var/flarum/public
php_fastcgi 127.0.0.1:9000
file_server
header /assets {
+Cache-Control "public, must-revalidate, proxy-revalidate"
+Cache-Control "max-age=25000"
Pragma "public"
}
encode gzip
}
PKGS
----
# pkg info | grep php
php74-7.4.13 PHP Scripting Language
php74-composer-1.10.10 Dependency Manager for PHP
php74-ctype-7.4.13 The ctype shared extension for php
php74-curl-7.4.13 The curl shared extension for php
php74-dom-7.4.13 The dom shared extension for php
php74-fileinfo-7.4.13 The fileinfo shared extension for php
php74-filter-7.4.13 The filter shared extension for php
php74-gd-7.4.13 The gd shared extension for php
php74-intl-7.4.13 The intl shared extension for php
php74-json-7.4.13 The json shared extension for php
php74-mbstring-7.4.13 The mbstring shared extension for php
php74-openssl-7.4.13 The openssl shared extension for php
php74-pdo-7.4.13 The pdo shared extension for php
php74-pdo_mysql-7.4.13 The pdo_mysql shared extension for php
php74-phar-7.4.13 The phar shared extension for php
php74-session-7.4.13 The session shared extension for php
php74-tokenizer-7.4.13 The tokenizer shared extension for php
php74-zip-7.4.13 The zip shared extension for php
FLARUM
------
# php flarum --no-ansi info
Flarum core 0.1.0-beta.15
PHP version: 7.4.13
Loaded extensions: Core, date, libxml, pcre, hash, Reflection, SPL, session, standard, mysqlnd, ctype, curl, dom, fileinfo, filter, gd, intl, json, mbstring, openssl, PDO, Phar, tokenizer, zip, pdo_mysql
+----------------------+----------------+--------+
| Flarum Extensions | | |
+----------------------+----------------+--------+
| ID | Version | Commit |
+----------------------+----------------+--------+
| flarum-approval | v0.1.0-beta.15 | |
| flarum-emoji | v0.1.0-beta.15 | |
| flarum-lang-english | v0.1.0-beta.15 | |
| flarum-flags | v0.1.0-beta.15 | |
| flarum-likes | v0.1.0-beta.15 | |
| flarum-lock | v0.1.0-beta.15 | |
| flarum-markdown | v0.1.0-beta.15 | |
| flarum-mentions | v0.1.0-beta.15 | |
| flarum-statistics | v0.1.0-beta.15 | |
| flarum-sticky | v0.1.0-beta.15 | |
| flarum-subscriptions | v0.1.0-beta.15 | |
| flarum-suspend | v0.1.0-beta.15 | |
| flarum-tags | v0.1.0-beta.15 | |
+----------------------+----------------+--------+
Base URL: https://fbsd2-001.shell.pchak.net
Installation path: /var/flarum
Debug mode: off
#!/bin/sh
set -o errexit
set -o pipefail
set -o nounset
# Ensure DB password set
: ${FLARUM_DB_PW?ERROR: Must set FLARUM_DB_PW}
# Install dependencies
pkg install -y php74 php74-composer php74-ctype php74-curl php74-dom php74-fileinfo php74-filter php74-gd php74-intl php74-json php74-mbstring php74-openssl php74-pdo php74-pdo_mysql php74-phar php74-session php74-tokenizer php74-zip
pkg install -y mariadb105-client mariadb105-server
pkg install -y caddy
# Enable services
sysrc mysql_enable="YES" php_fpm_enable="YES" caddy_enable=YES
# Create Caddyfile
tee /usr/local/etc/caddy/Caddyfile <<EOM
$(hostname) {
root * /var/flarum/public
php_fastcgi 127.0.0.1:9000
file_server
header /assets {
+Cache-Control "public, must-revalidate, proxy-revalidate"
+Cache-Control "max-age=25000"
Pragma "public"
}
encode gzip
}
EOM
# Start services
service mysql-server restart
service php-fpm restart
service caddy restart
# Setup database/user
mysql <<EOM
create user flarum@localhost identified by '${FLARUM_DB_PW}';
create database flarum;
grant all privileges on flarum.* to flarum@localhost;
flush privileges;
EOM
# Install Flarum
mkdir /var/flarum
cd /var/flarum
composer create-project flarum/flarum . --stability=beta
chown -R www:www .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment