From 44e424362e1f7b731a5d33268fe6ca43b0e6b219 Mon Sep 17 00:00:00 2001 From: Remy Jette Date: Mon, 9 Mar 2026 00:51:26 -0700 Subject: [PATCH] Docs: Don't serve non-static files in example_nginx.conf (#5971) * Docs: Don't serve non-static files in example_nginx.conf `try_files` will serve the file as long as it exists, which means I could `GET /autolauncher.py` and be served the file. * Use root instead of alias, add route for favicon * Update deploy/example_nginx.conf --- deploy/example_nginx.conf | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/deploy/example_nginx.conf b/deploy/example_nginx.conf index b0c0e8e5a0..a4f042739c 100644 --- a/deploy/example_nginx.conf +++ b/deploy/example_nginx.conf @@ -41,16 +41,8 @@ http { # server_name example.com www.example.com; keepalive_timeout 5; - - # path for static files - root /app/WebHostLib; - + location / { - # checks for static file, if not found proxy to app - try_files $uri @proxy_to_app; - } - - location @proxy_to_app { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; @@ -60,5 +52,14 @@ http { proxy_pass http://app_server; } + + location /static/ { + root /app/WebHostLib/; + autoindex off; + } + + location = /favicon.ico { + alias /app/WebHostLib/static/static/favicon.ico; + access_log off; } }