Category Archives: Logs, Tips, and Scripts

Host WordPress with Caddy web server

# Add repository and install through APT
apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | apt-key add -
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list
apt update
apt install caddy php-fpm php-mysql php-curl php-gd php-mbstring php-common php-xml php-xmlrpc -y
# Install MariaDB
apt install mariadb-server -y
mysql_secure_installation 
# Create database
mysql -uroot -p
create database ariw;
grant all on ariw.* to 'ariw'@'localhost' identified by 'LuGueEnd!';
flush privileges;
# Download WordPress
mkdir /ssd/www/ariw.net && cd /ssd/www/ariw.net && wget wordpress.org/latest.zip && unzip latest.zip && mv wordpress/* ./ && rmdir wordpress
# Create Caddyfile (/etc/caddy/Caddyfile)
ariw.net, www.ariw.net {
        tls {
        dns cloudflare yOurCloudFlareTokenHere0D7Fkei-suZR4P7y5kQ0
        }

        root * /ssd/www/ariw.net
        php_fastcgi unix//run/php/php7.4-fpm.sock
        file_server

        @disallowed {
        path /xmlrpc.php
        path *.sql
        path /wp-content/uploads/*.php
        }

        rewrite @disallowed '/index.php'

}

Raspberry Pi – mount external SSD on boot

# Make mount point directory
root@pie:~# mkdir /ssd
# Find out device UUID
root@pie:~# blkid
/dev/mmcblk0p1: LABEL_FATBOOT="system-boot" LABEL="system-boot" UUID="4D3B-86C0" TYPE="vfat" PARTUUID="4ec8ea53-01"
/dev/mmcblk0p2: LABEL="writable" UUID="79af43d1-801b-4c28-81d5-724c930bcc83" TYPE="ext4" PARTUUID="4ec8ea53-02"
/dev/sda: UUID="13ccd2a1-3e29-4c16-847a-68c52c4c3577" TYPE="ext4"
# Edit /etc/fstab
LABEL=writable	/	 ext4	defaults	0 0
LABEL=system-boot       /boot/firmware  vfat    defaults        0       1
UUID=13ccd2a1-3e29-4c16-847a-68c52c4c3577 /ssd ext4 defaults,auto,users,rw,nofail 0 0