From 2a2430ee26f3e44afb29689a1024ce5c1a4d4542 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Fri, 15 Jul 2022 11:47:37 +0530 Subject: [PATCH] Transition to caddy --- README.md | 3 +-- caddy/dl.msfjarvis.dev | 33 +++++++++++++++++++++++++++++++ nginx/dl.msfjarvis.dev | 45 ------------------------------------------ 3 files changed, 34 insertions(+), 47 deletions(-) create mode 100644 caddy/dl.msfjarvis.dev delete mode 100644 nginx/dl.msfjarvis.dev diff --git a/README.md b/README.md index 0e203ea..ff93510 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,7 @@ Configuration files for various parts of my webserver ### Files -- [nginx](nginx): NGINX configurations for the sites I self-host. - - [dl.msfjarvis.dev](nginx/dl.msfjarvis.dev): NGINX config for my download host +- [caddy](caddy): Caddy configurations for the sites I self-host. - [systemd-units](systemd_units): Systemd units for various custom services I have on the webserver. - [mirror-bot.service](systemd_units/mirror-bot.service): Systemd unit for [aria-telegram-mirror-bot](https://github.com/out386/aria-telegram-mirror-bot). - [uno-bot.service](systemd_units/uno-bot.service): Service unit for the [mau_mau_bot](https://github.com/msfjarvis/mau_mau_bot) instance I run to play UNO with friends. diff --git a/caddy/dl.msfjarvis.dev b/caddy/dl.msfjarvis.dev new file mode 100644 index 0000000..41faa15 --- /dev/null +++ b/caddy/dl.msfjarvis.dev @@ -0,0 +1,33 @@ +i915box.tiger-shark.ts.net { + root * /var/www/dl.msfjarvis.dev + php_fastcgi unix//run/php/php-fpm.sock { + try_files {path} {path}/index.php /_h5ai/public/index.php =404 + } + file_server + encode gzip + @static { + file + path *.ico *.css *.js *.gif *.jpg *.jpeg *.png *.svg *.woff *.pdf *.webp + } + header @static Cache-Control max-age=5184000 +} + +dl.msfjarvis.dev { + root * /var/www/dl.msfjarvis.dev + php_fastcgi unix//run/php/php-fpm.sock { + try_files {path} {path}/index.php /_h5ai/public/index.php =404 + } + tls /etc/caddy/cert.pem /etc/caddy/key.pem { + client_auth { + mode require_and_verify + trusted_ca_cert_file /etc/caddy/cloudflare_origin_cert.pem + } + } + file_server + encode gzip + @static { + file + path *.ico *.css *.js *.gif *.jpg *.jpeg *.png *.svg *.woff *.pdf *.webp + } + header @static Cache-Control max-age=5184000 +} diff --git a/nginx/dl.msfjarvis.dev b/nginx/dl.msfjarvis.dev deleted file mode 100644 index 36c7ba4..0000000 --- a/nginx/dl.msfjarvis.dev +++ /dev/null @@ -1,45 +0,0 @@ -# generated 2020-08-25, Mozilla Guideline v5.6, nginx 1.17.7, OpenSSL 1.1.1d, intermediate configuration -# https://ssl-config.mozilla.org/#server=nginx&version=1.17.7&config=intermediate&openssl=1.1.1d&guideline=5.6 -server { - listen 80; - listen [::]:80; - - server_name dl.msfjarvis.dev; - - return 301 https://$host$request_uri; -} - -server { - listen 443 ssl http2; - listen [::]:443 ssl http2; - - server_name dl.msfjarvis.dev; - - root /var/www/dl.msfjarvis.dev; - index index.html index.php /_h5ai/public/index.php; - - ssl_certificate /etc/ssl/certs/cert.pem; - ssl_certificate_key /etc/ssl/private/key.pem; - ssl_client_certificate /etc/ssl/certs/cloudflare.crt; - ssl_verify_client on; - ssl_session_cache shared:MozSSL:10m; # about 40000 sessions - ssl_session_tickets off; - - # curl https://ssl-config.mozilla.org/ffdhe2048.txt > /path/to/dhparam - ssl_dhparam /etc/nginx/dhparam; - - # intermediate configuration - ssl_protocols TLSv1.2 TLSv1.3; - ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384; - ssl_prefer_server_ciphers off; - - # HSTS (ngx_http_headers_module is required) (63072000 seconds) - add_header Strict-Transport-Security "max-age=63072000" always; - - location ~ \.php$ { - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; - fastcgi_index index.php; - include fastcgi.conf; - } -}