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'

}

Leave a Reply

Your email address will not be published.