Table of Contents

Information

Prerequisites

Notes

Download Source

sudo git clone -b '8.3.x' 'git://git.drupal.org/project/drupal.git' '/var/www/main' && sudo chown -R 'www-data':'www-data' '/var/www/main' && sudo -u 'www-data' composer install -d '/var/www/main' --no-dev && sync

Database

sudo mysql
CREATE DATABASE drupal;
GRANT ALL PRIVILEGES ON drupal.* to 'drupal'@'localhost' IDENTIFIED BY 'x';
FLUSH PRIVILEGES;

nginx + PHP-FPM Configuration

PHP-FPM Socket

sudo -e '/etc/php/7.0/fpm/pool.d/main.conf' && sudo systemctl restart 'php7.0-fpm'
[main]
user = www-data
group = www-data

listen = /run/php/main.sock
listen.owner = www-data
listen.group = www-data
listen.allowed_clients = 127.0.0.1

pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3

php_value[max_execution_time] = 300
php_value[request_terminate_timeout] = 300

FastCGI

sudo -e '/etc/nginx/snippets/main.conf'
location ~ '\.php$|^/update.php' {
    fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
    try_files $fastcgi_script_name =404;
    set $path_info $fastcgi_path_info;
    fastcgi_param PATH_INFO $path_info;
    include fastcgi.conf;
    fastcgi_intercept_errors on;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param HTTPS on;
    fastcgi_pass unix:/run/php/main.sock;
    fastcgi_read_timeout 300;
}

Server Block

sudo -e '/etc/nginx/sites-available/main.conf'
server {
    listen '443' 'ssl' 'http2';
    server_name 'realmofespionage.xyz';
    root '/var/www/main';
    index 'index.php';

    include '/etc/nginx/snippets/main.conf';
    include '/etc/nginx/snippets/restrictions.conf';

    #access_log /var/log/nginx/main-access.log;
    #error_log /var/log/nginx/main-error.log;

    location / {
        try_files $uri /index.php?$query_string;
    }

    location @rewrite {
        rewrite ^/(.*)$ /index.php?q=$1;
    }

    location ~ /vendor/.*\.php$ {
        deny all;
        return 404;
    }

    location ~ ^/sites/.*/files/styles/ {
        try_files $uri @rewrite;
    }

    location ~ ^/system/files/ {
        try_files $uri /index.php?$query_string;
    }
}

Enable Server Block

sudo rm -f '/etc/nginx/sites-enabled/main.conf' && sudo ln -s '/etc/nginx/sites-available/main.conf' '/etc/nginx/sites-enabled' && sudo systemctl reload 'nginx'

Initial Setup

Plugins

T3 Framework

Purity III Template

Settings

Global Configuration

Site Meta Description

Realm of Espionage is an internet community with the main focus points of gaming, transparency, and the promotion of open-source technologies and security.

Site Meta Keywords

privacy,linux,floss,foss,free,open,open-source,gnu,secure,hardened,ubuntu,espionage724,gw2,wow,gaming,realm of espionage,roe,free and open-source software,transparent,transparency,letsencrypt,freedom,decentralized,self-host,self-hosted,in-house,decentralization

Content Rights

Creative Commons Attribution-ShareAlike 4.0 International

Articles

Purity III

Edit Style

Theme Magic

Footer

sudo -u 'www-data' wget 'https://licensebuttons.net/l/by-sa/4.0/80x15.png' -O '/var/www/main/images/cc-by-sa-40.png'

Text

sudo -u 'www-data' -e '/var/www/main/templates/purity_iii/tpls/blocks/footer.php'
          <small>
            This site is powered by <a href="https://www.joomla.org" target="_blank">Joomla!</a>, <a href="http://www.t3-framework.org" target="_blank">T3 Framework</a>, <a href="https://www.joomlart.com/joomla/templates/purity-iii" target="_blank">Purity III</a>, <a href="https://getbootstrap.com" target="_blank">Bootstrap</a>, and <a href="http://fontawesome.io" target="_blank">Font Awesome</a>.
          </small>
          <small>
            Dark <a href="https://wiki.realmofespionage.xyz/servers:nginx:joomla" target="_blank">words of power</a> were used in order to spawn this site. <div style="display:none;">(beware of imps)</div>
          </small>
          <small>
            <img src="https://realmofespionage.xyz/images/cc-by-sa-40.png" width="80" height="15" /> All content and data available on Realm of Espionage is available under the <a href="https://creativecommons.org/licenses/by-sa/4.0" target="_blank">Creative Commons Attribution-ShareAlike 4.0 International</a> license.
          </small>

Position Fix

sudo -u 'www-data' -e '/var/www/main/templates/purity_iii/css/custom.css'
/* Footer Styling */

.t3-copyright {
background: #484848 none repeat scroll 0 0;
border-top: 1px solid #eeeeee;
bottom: 0;
font-size: 12px;
left: 0;
padding: 15px 0 0px;
position: fixed;
width: 100%;
}

.t3-footer {
/*padding-bottom: 209px;*/
bottom: 0;
font-size: 12px;
left: 0;
}

Services

Updater

Service

sudo -e '/etc/systemd/system/main-up.service'
[Service]
User=www-data
Group=www-data
Type=oneshot
ExecStart='/usr/bin/git' -C '/var/www/main' pull origin 'staging'
ExecStart='/bin/sync'

Timer

sudo -e '/etc/systemd/system/main-up.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'main-up.timer' --now && sudo systemctl start 'main-up' && sudo systemctl status 'main-up' -l
[Unit]
Description=Joomla! Git Updater
Wants=network-online.target

[Timer]
OnCalendar=*-*-* 01:35:00
Persistent=true

[Install]
WantedBy=timers.target

Backup

Database Auth

sudo -e '/var/lib/mysqlauth/joomla' && sudo chmod '600' '/var/lib/mysqlauth/joomla'
[mysqldump]
user=joomla
password=x

Service

mkdir -p ~/'backups' && sudo mkdir -p '/var/lib/mysqltmp' && sudo -e '/etc/systemd/system/main-b.service' && sudo sed -i 's/CHANGEME/'$USER'/g' '/etc/systemd/system/main-b.service'
[Service]
Type=oneshot
WorkingDirectory=/var/lib/mysqltmp
ExecStart='/usr/bin/mysqldump' --defaults-extra-file='/var/lib/mysqlauth/joomla' --single-transaction 'joomla' -r '/var/lib/mysqltmp/joomla.sql'
ExecStart='/bin/gzip' -f '/var/lib/mysqltmp/joomla.sql'
ExecStart='/bin/bash' -c '"/bin/mv" "/var/lib/mysqltmp/joomla.sql.gz" "/home/CHANGEME/backups/joomla-"$$(date +%%Y-%%m-%%d)".sql.gz"'
ExecStart='/bin/sync'

Timer

sudo -e '/etc/systemd/system/main-b.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'main-b.timer' --now && sudo systemctl start 'main-b' && sudo systemctl status 'main-b' -l
[Unit]
Description=Joomla! Database Backup
After=mysql.service

[Timer]
OnCalendar=*-*-* 01:40:00
Persistent=true

[Install]
WantedBy=timers.target

Backup

Server

Stop Services

sudo systemctl stop nginx php7.0-fpm

Backup Folder

cd '/var/www' && tar -cvzf ~/'main-manual.tar.gz' 'main' && cd ~ && sync

Backup Database

mysqldump --defaults-extra-file='/var/lib/mysqlauth/joomla' --single-transaction 'joomla' -r '~/'joomla-manual.sql' && sync

Start Services

sudo systemctl start nginx php7.0-fpm

Client

Transfer Files To Client

scp espionage724@192.168.1.153:~/'main-manual.tar.gz' ~/'joomla-manual.sql' ~/'Downloads' && sync'

Restore

Client

Transfer Files To Server

scp  ~/'Downloads/main-manual.tar.gz' ~/'Downloads/joomla-manual.sql' espionage724@192.168.1.153:~

Remove Files

rm ~/'Downloads/main-manual.tar.gz' ~/'Downloads/joomla-manual.sql' && sync

Server

Stop Services

sudo systemctl stop nginx php7.0-fpm

Remove Previous Folder

sudo rm -Rf '/var/www/main'

Restore Joomla! Folder

cd '/var/www' && sudo tar -xvzf ~/'main-manual.tar.gz' 'main' && sudo chown -R 'www-data':'www-data' '/var/www/main' && cd ~ && sync

Drop Previous Database

sudo mysql
DROP DATABASE joomla;
FLUSH TABLES;

Re-create Databases

sudo mysql
CREATE DATABASE joomla;

Restore Database

sudo mysql 'joomla' < ~/'joomla-manual.sql' && sync

Reapply Permissions

sudo mysql
GRANT ALL PRIVILEGES ON joomla.* to 'joomla'@'localhost' IDENTIFIED BY 'x';
FLUSH PRIVILEGES;

Start Services

sudo systemctl start nginx php7.0-fpm

Remove Backups

rm ~/'main-manual.tar.gz' ~/'joomla-manual.sql' && sync
2)
only the template is needed
3)
if shown, it causes a 3rd-party asset to be loaded; why they didn't just include it in the theme files is beyond me
4)
it doesn't play nicely with the footer position fix