October CMS è una piattaforma di gestione dei contenuti gratuita e self-hosted, costruita sul framework PHP Laravel e con il codice sorgente pubblicato su GitHub. Ereditando la struttura di Laravel, piace sia a chi vuole semplicemente pubblicare contenuti sia agli sviluppatori che cercano una base solida su cui costruire plugin.
Questa guida copre una distribuzione completa su Debian 9 (stretch): Nginx davanti, MariaDB come database e, opzionalmente, un certificato SSL gratuito rilasciato tramite il client acme.sh e Let's Encrypt.
Requisiti
Le esigenze di hosting di October sono modeste:
- PHP 7.0 o superiore
- Estensioni PHP PDO, cURL, OpenSSL, XML e JSON
- Librerie Mbstring, Zip e GD
- Apache con
mod_rewriteoppure Nginx - MySQL, MariaDB, PostgreSQL o SQLite
Prerequisiti
- Un sistema con Debian 9 (stretch).
- Un utente non root con privilegi sudo.
Preparazione iniziale del sistema
lsb_release -ds
# Debian GNU/Linux 9.7 (stretch)
dpkg-reconfigure tzdata
Aggiornate il sistema di base prima di installare qualsiasi altra cosa:
apt update && apt upgrade -y
Installate le utility che vi torneranno utili durante la gestione della macchina:
apt install -y curl wget vim git sudo unzip socat bash-completion dirmngr apt-transport-https
Passo 1: installare PHP e le estensioni
Debian 9 include PHP 7.0 nel repository principale, che soddisfa il minimo richiesto da October. Installatelo insieme alle estensioni necessarie:
sudo apt install -y php7.0 php7.0-cli php7.0-fpm php7.0-common php7.0-mysql php7.0-curl php7.0-json php7.0-zip php7.0-gd php7.0-xml php7.0-mbstring
php -m
ctype
curl
exif
fileinfo
. . .
php --version
# PHP 7.0.33-0+deb9u1 (cli) (built: Dec 7 2018 11:36:49) ( NTS )
Su Debian 9 PHP-FPM è già in esecuzione e configurato per l'avvio automatico: non serve altro.
Passo 2: installare MariaDB e creare il database
October supporta MySQL/MariaDB, PostgreSQL, SQLite e SQL Server. Da stretch Debian ha sostituito MySQL con MariaDB, quindi qui la scelta naturale è MariaDB. Se preferite MySQL di Oracle, aggiungete il repository ufficiale di MySQL.
sudo apt install -y software-properties-common dirmngr apt-transport-https
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] https://mirrors.nxthost.com/mariadb/repo/10.2/debian stretch main'
sudo apt update
sudo apt install -y mariadb-server
mysql --version
# mysql Ver 15.1 Distrib 10.2.21-MariaDB, for debian-linux-gnu (x86_64)
Rendete sicuro il server e definite una password di root:
sudo mysql_secure_installation
Enter current password for root (enter for none): Press Enter
Set root password? [Y/n] Y
New password: your_secure_password
Re-enter new password: your_secure_password
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y
sudo mysql -u root -p
# Enter password
CREATE DATABASE dbname;
GRANT ALL ON dbname.* TO 'username' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
quit
Passo 3: ottenere un certificato Let's Encrypt (opzionale)
HTTPS non è obbligatorio per October, ma non c'è motivo di servire un sito senza. Acme.sh è un client per shell UNIX puro, senza dipendenze, quindi si presta bene anche ai sistemi minimi.
sudo su - root
git clone https://github.com/Neilpang/acme.sh.git
cd acme.sh
./acme.sh --install --accountemail [email protected]
source ~/.bashrc
cd ~
acme.sh --version
# v2.8.0
Richiedete entrambi i tipi di certificato per il vostro dominio:
# RSA 2048
acme.sh --issue --standalone -d example.com --keylength 2048
# ECDSA
acme.sh --issue --standalone -d example.com --keylength ec-256
Aggiungete --staging se volete solo certificati di test. Al termine, certificati e chiavi si trovano in:
- RSA:
~/example.com - ECC/ECDSA:
~/example.com_ecc
acme.sh --list
mkdir -p /etc/letsencrypt/example.com
sudo mkdir -p /etc/letsencrypt/example.com_ecc
# RSA
acme.sh --install-cert -d example.com \
--cert-file /etc/letsencrypt/example.com/cert.pem \
--key-file /etc/letsencrypt/example.com/private.key \
--fullchain-file /etc/letsencrypt/example.com/fullchain.pem \
--reloadcmd "sudo systemctl reload nginx.service"
# ECC/ECDSA
acme.sh --install-cert -d example.com --ecc \
--cert-file /etc/letsencrypt/example.com_ecc/cert.pem \
--key-file /etc/letsencrypt/example.com_ecc/private.key \
--fullchain-file /etc/letsencrypt/example.com_ecc/fullchain.pem \
--reloadcmd "sudo systemctl reload nginx.service"
Il rinnovo è automatico ogni 60 giorni. Tornate al vostro utente sudo:
exit
Passo 4: installare e configurare Nginx
sudo apt install -y nginx
sudo nginx -v
# nginx version: nginx/1.10.3
sudo vim /etc/nginx/sites-available/october.conf
La configurazione seguente instrada le richieste attraverso index.php e blocca l'accesso diretto ai percorsi interni di asset e risorse di October:
server {
listen [::]:443 ssl http2;
listen 443 ssl http2;
listen [::]:80;
listen 80;
server_name example.com;
index index.php index.html;
root /var/www/october;
ssl_certificate /etc/letsencrypt/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/example.com/private.key;
ssl_certificate /etc/letsencrypt/example.com_ecc/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/example.com_ecc/private.key;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_read_timeout 120s;
}
location ~ ^/favicon\.ico { try_files $uri /index.php; }
location ~ ^/sitemap\.xml { try_files $uri /index.php; }
location ~ ^/robots\.txt { try_files $uri /index.php; }
location ~ ^/humans\.txt { try_files $uri /index.php; }
location ~ ^/storage/app/uploads/public { try_files $uri 404; }
location ~ ^/storage/app/media { try_files $uri 404; }
location ~ ^/storage/temp/public { try_files $uri 404; }
location ~ ^/modules/.*/assets { try_files $uri 404; }
location ~ ^/modules/.*/resources { try_files $uri 404; }
location ~ ^/modules/.*/behaviors/.*/assets { try_files $uri 404; }
location ~ ^/modules/.*/behaviors/.*/resources { try_files $uri 404; }
location ~ ^/modules/.*/widgets/.*/assets { try_files $uri 404; }
location ~ ^/modules/.*/widgets/.*/resources { try_files $uri 404; }
location ~ ^/modules/.*/formwidgets/.*/assets { try_files $uri 404; }
location ~ ^/modules/.*/formwidgets/.*/resources { try_files $uri 404; }
location ~ ^/modules/.*/reportwidgets/.*/assets { try_files $uri 404; }
location ~ ^/modules/.*/reportwidgets/.*/resources { try_files $uri 404; }
location ~ ^/plugins/.*/.*/assets { try_files $uri 404; }
location ~ ^/plugins/.*/.*/resources { try_files $uri 404; }
location ~ ^/plugins/.*/.*/behaviors/.*/assets { try_files $uri 404; }
location ~ ^/plugins/.*/.*/behaviors/.*/resources { try_files $uri 404; }
location ~ ^/plugins/.*/.*/reportwidgets/.*/assets { try_files $uri 404; }
location ~ ^/plugins/.*/.*/reportwidgets/.*/resources { try_files $uri 404; }
location ~ ^/plugins/.*/.*/formwidgets/.*/assets { try_files $uri 404; }
location ~ ^/plugins/.*/.*/formwidgets/.*/resources { try_files $uri 404; }
location ~ ^/plugins/.*/.*/widgets/.*/assets { try_files $uri 404; }
location ~ ^/plugins/.*/.*/widgets/.*/resources { try_files $uri 404; }
location ~ ^/themes/.*/assets { try_files $uri 404; }
location ~ ^/themes/.*/resources { try_files $uri 404; }
}
sudo ln -s /etc/nginx/sites-available/october.conf /etc/nginx/sites-enabled
sudo nginx -t
sudo systemctl reload nginx.service
Passo 5: scaricare October CMS
sudo mkdir -p /var/www/october
sudo chown -R [your_user]:[your_user] /var/www/october
cd /var/www/october
wget https://octobercms.com/download -O october.zip
unzip october.zip
rm october.zip
mv install-master/* .
sudo chown -R www-data:www-data /var/www/october
Ora visitate example.com/install.php nel browser.
Passo 6: completare la configurazione
Attendete la fine del controllo di sistema, poi premete "Agree & Continue":

Inserite le credenziali del database e i dati dell'account amministratore:


Le opzioni avanzate possono restare ai valori predefiniti:

Premete il pulsante blu Continue. Scegliete quindi come popolare il sito: Start from scratch, Start from a theme oppure Use a project ID:

L'area di amministrazione si trova al vostro URL seguito da /backend.
Per sicurezza, eliminate l'installer al termine:
sudo rm /var/www/october/install.php && sudo rm -rf /var/www/october/install_files
Link utili
- https://octobercms.com/
- https://github.com/octobercms/october