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
This commit is contained in:
Remy Jette
2026-03-09 00:51:26 -07:00
committed by GitHub
parent 371db53371
commit 44e424362e

View File

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