Transition to caddy

This commit is contained in:
Harsh Shandilya 2022-07-15 11:47:37 +05:30
parent 446773b688
commit 2a2430ee26
No known key found for this signature in database
GPG Key ID: 366D7BBAD1031E80
3 changed files with 34 additions and 47 deletions

View File

@ -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.

33
caddy/dl.msfjarvis.dev Normal file
View File

@ -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
}

View File

@ -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;
}
}