From 48ab2daec32bd84a318ef3c6a816326e5f4bb2ff Mon Sep 17 00:00:00 2001 From: Drikus Roor Date: Wed, 7 Feb 2024 17:33:18 +0100 Subject: [PATCH] config: Update nginx configuration to proxy requests to Django app --- nginx/custom-nginx.conf | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/nginx/custom-nginx.conf b/nginx/custom-nginx.conf index dbcebdc3e..af52e2d14 100644 --- a/nginx/custom-nginx.conf +++ b/nginx/custom-nginx.conf @@ -17,9 +17,17 @@ server { alias /nginx/upload/; } - # Proxy other /server/* requests to the Django app + # Serve files from /test-path/ from the /nginx/static/ directory + location /test-path/ { + alias /nginx/static/; + } + + # Proxy other /server/* requests to the Django app that runs on http://localhost:8000 location /server/ { - rewrite ^/server(/.*)$ $1 break; - proxy: [http://localhost:8000](http://localhost:8000 "http://localhost:8000/"); + proxy_pass http://localhost:8000; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; } }