From 08d731adc265d7f1145b1bff6bc4e1d14f03917b Mon Sep 17 00:00:00 2001 From: Raine Date: Thu, 26 Oct 2023 14:30:28 +0200 Subject: [PATCH] feat: add cdn --- .../custom/nginx/conf.d/cdn.conf | 35 +++++++++++++++++++ .../docker-compose.d/custom/nginx/nginx.conf | 2 ++ .../docker-compose.d/docker-compose.yml | 2 +- 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 servers/keymaker/docker-compose.d/custom/nginx/conf.d/cdn.conf diff --git a/servers/keymaker/docker-compose.d/custom/nginx/conf.d/cdn.conf b/servers/keymaker/docker-compose.d/custom/nginx/conf.d/cdn.conf new file mode 100644 index 0000000..301573d --- /dev/null +++ b/servers/keymaker/docker-compose.d/custom/nginx/conf.d/cdn.conf @@ -0,0 +1,35 @@ +server { + listen 80; + server_name cdn.ixvd.net; + + proxy_cache cache; + proxy_cache_valid 200 30m; + proxy_cache_valid 404 1m; + + proxy_buffering on; + proxy_ignore_headers Expires; + proxy_ignore_headers X-Accel-Expires; + proxy_ignore_headers Cache-Control; + proxy_ignore_headers Set-Cookie; + + proxy_hide_header X-Accel-Expires; + proxy_hide_header Expires; + proxy_hide_header Cache-Control; + proxy_hide_header Pragma; + + proxy_intercept_errors on; + proxy_redirect off; + + location @404 { + return 404; + } + + location / { + root /usr/share/nginx/html; + } + + location ~ /assets(.*) { + proxy_pass https://git.ixvd.net/ixvd/assets/raw/branch/main$1; + } + +} \ No newline at end of file diff --git a/servers/keymaker/docker-compose.d/custom/nginx/nginx.conf b/servers/keymaker/docker-compose.d/custom/nginx/nginx.conf index 2f54d99..da82504 100644 --- a/servers/keymaker/docker-compose.d/custom/nginx/nginx.conf +++ b/servers/keymaker/docker-compose.d/custom/nginx/nginx.conf @@ -31,5 +31,7 @@ http { #gzip on; + proxy_cache_path /tmp/cache keys_zone=cache:1h; + include /etc/nginx/conf.d/*.conf; } diff --git a/servers/keymaker/docker-compose.d/docker-compose.yml b/servers/keymaker/docker-compose.d/docker-compose.yml index 4098931..7a7e599 100644 --- a/servers/keymaker/docker-compose.d/docker-compose.yml +++ b/servers/keymaker/docker-compose.d/docker-compose.yml @@ -7,7 +7,7 @@ services: build: custom/nginx environment: CERTBOT_EMAIL: "webmaster@ixvd.net" - CERTBOT_DOMAINS: "keymaker.ixvd.net" + CERTBOT_DOMAINS: "keymaker.ixvd.net,ixvd.net,via.ixvd.net,cdn.ixvd.net" volumes: - /srv/certbot/data:/etc/letsencrypt - /srv/certbot/other/www:/var/www/certbot