From 586d3658b763c9d5cabc7fa44ab267e3fba6fc51 Mon Sep 17 00:00:00 2001 From: Joby Elliott Date: Wed, 23 Oct 2024 21:27:12 -0600 Subject: [PATCH] config fix --- site-config.conf | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/site-config.conf b/site-config.conf index 796b267..3c083c0 100644 --- a/site-config.conf +++ b/site-config.conf @@ -29,6 +29,21 @@ server { return 403 "403 Forbidden (IP temporarily banned)\n"; } + # Apply general rate limit + limit_req zone=general burst=100 nodelay; + + # Content Security Policy (needs to be per-domain) + add_header Content-Security-Policy "default-src 'self' *.$DOMAIN; script-src 'self' 'unsafe-inline' 'unsafe-eval' *.$DOMAIN; style-src 'self' 'unsafe-inline' *.$DOMAIN; img-src 'self' data: *.$DOMAIN; font-src 'self' data: *.$DOMAIN; connect-src 'self' *.$DOMAIN; frame-src 'self' *.$DOMAIN; media-src 'self' *.$DOMAIN; object-src 'none'; base-uri 'self'; form-action 'self' *.$DOMAIN" always; + + # Subdomain handling + set $subdomain ''; + set $site_root "/var/www/$DOMAIN/_main"; + if ($host ~* ^([^.]+)\.$DOMAIN$) { + set $subdomain $1; + set $site_root "/var/www/$DOMAIN/subdomains/$subdomain"; + } + root "$site_root/www"; + # Site-specific error pages error_page 403 /site-error-page/403.html; error_page 404 /site-error-page/404.html; @@ -52,21 +67,6 @@ server { # Default error page config include snippets/error-pages.conf; - # Apply general rate limit - limit_req zone=general burst=100 nodelay; - - # Content Security Policy (needs to be per-domain) - add_header Content-Security-Policy "default-src 'self' *.$DOMAIN; script-src 'self' 'unsafe-inline' 'unsafe-eval' *.$DOMAIN; style-src 'self' 'unsafe-inline' *.$DOMAIN; img-src 'self' data: *.$DOMAIN; font-src 'self' data: *.$DOMAIN; connect-src 'self' *.$DOMAIN; frame-src 'self' *.$DOMAIN; media-src 'self' *.$DOMAIN; object-src 'none'; base-uri 'self'; form-action 'self' *.$DOMAIN" always; - - # Subdomain handling - set $subdomain ''; - set $site_root "/var/www/$DOMAIN/_main"; - if ($host ~* ^([^.]+)\.$DOMAIN$) { - set $subdomain $1; - set $site_root "/var/www/$DOMAIN/subdomains/$subdomain"; - } - root "$site_root/www"; - # Basic settings index index.html index.htm index.php; client_max_body_size 20M;