From c875001c96a32696f760d97f32565312f6bcdca0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mauritz=20Hardersen=20Skog=C3=B8y?= Date: Tue, 4 Mar 2025 11:29:00 +0100 Subject: [PATCH 1/2] Fix from server --- nginx_secfit.conf | 50 +++++++++++++++++++++------------------------- nginx_template.txt | 2 +- 2 files changed, 24 insertions(+), 28 deletions(-) diff --git a/nginx_secfit.conf b/nginx_secfit.conf index 04b2ae4..f4c9a36 100644 --- a/nginx_secfit.conf +++ b/nginx_secfit.conf @@ -1,35 +1,31 @@ -# Production server configuration server { - listen 80; + listen 80; - location / { - proxy_pass http://0.0.0.0:${PROD_PORT_PREFIX}${GATEWAY_POSTFIX}/; - proxy_set_header Host $http_host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - } + location / { + proxy_pass http://0.0.0.0:23/; + proxy_set_header Host ; + proxy_set_header X-Real-IP ; + proxy_set_header X-Forwarded-For ; + } } -# Development server configuration server { - listen ${DEV_PORT_PREFIX}7; - - location / { - proxy_pass http://0.0.0.0:${DEV_PORT_PREFIX}${GATEWAY_POSTFIX}/; - proxy_set_header Host $http_host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - } + listen 217; + location / { + proxy_pass http://0.0.0.0:/; + proxy_set_header Host ; + proxy_set_header X-Real-IP ; + proxy_set_header X-Forwarded-For ; + } } -# Staging server configuration -server { - listen ${STAG_PORT_PREFIX}${GATEWAY_POSTFIX}7; - location / { - proxy_pass http://0.0.0.0:${STAG_PORT_PREFIX}${GATEWAY_POSTFIX}/; - proxy_set_header Host $http_host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - } -} \ No newline at end of file +server { + listen 227; + location / { + proxy_pass http://0.0.0.0:22/; + proxy_set_header Host ; + proxy_set_header X-Real-IP ; + proxy_set_header X-Forwarded-For ; + } +} diff --git a/nginx_template.txt b/nginx_template.txt index 26926ed..6ff2deb 100644 --- a/nginx_template.txt +++ b/nginx_template.txt @@ -12,7 +12,7 @@ server { server { listen ${DEV_PORT_PREFIX}7; location / { - proxy_pass http://0.0.0.0:${envDEV_PORT_PREFIX}${GATEWAY_POSTFIX}/; + proxy_pass http://0.0.0.0:${DEV_PORT_PREFIX}${GATEWAY_POSTFIX}/; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; From 74f00bba0fb8bc746d7ca03fd45de4e3dc0d2d18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mauritz=20Hardersen=20Skog=C3=B8y?= Date: Tue, 4 Mar 2025 11:57:40 +0100 Subject: [PATCH 2/2] Fix again --- nginx.conf | 31 ++++++++++++++++++++++++ nginx/nginx.conf | 62 +++++++++++++++++------------------------------- 2 files changed, 53 insertions(+), 40 deletions(-) create mode 100644 nginx.conf diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..158a736 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,31 @@ +server { + listen 80; + + location / { + proxy_pass http://0.0.0.0:23/; + proxy_set_header Host ; + proxy_set_header X-Real-IP ; + proxy_set_header X-Forwarded-For ; + } +} + +server { + listen 217; + location / { + proxy_pass http://0.0.0.0:21/; + proxy_set_header Host ; + proxy_set_header X-Real-IP ; + proxy_set_header X-Forwarded-For ; + } +} + + +server { + listen 227; + location / { + proxy_pass http://0.0.0.0:22/; + proxy_set_header Host ; + proxy_set_header X-Real-IP ; + proxy_set_header X-Forwarded-For ; + } +} diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 131034d..f4c9a36 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -1,49 +1,31 @@ -user nginx; -worker_processes 1; -error_log /var/log/nginx/error.log warn; -pid /var/run/nginx.pid; - - -events { - worker_connections 1024; -} - -http { - server { +server { listen 80; - # Route to frontend location / { - proxy_pass http://frontend:3000; - proxy_set_header Host $http_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; + proxy_pass http://0.0.0.0:23/; + proxy_set_header Host ; + proxy_set_header X-Real-IP ; + proxy_set_header X-Forwarded-For ; } +} - # Route to backend - location /api/ { - proxy_pass http://backend:8000; - proxy_set_header Host $http_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; +server { + listen 217; + location / { + proxy_pass http://0.0.0.0:/; + proxy_set_header Host ; + proxy_set_header X-Real-IP ; + proxy_set_header X-Forwarded-For ; } +} - location /admin/ { - proxy_pass http://backend:8000; - proxy_set_header Host $http_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; - } - location /static/admin/ { - proxy_pass http://backend:8000; - proxy_set_header Host $http_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; +server { + listen 227; + location / { + proxy_pass http://0.0.0.0:22/; + proxy_set_header Host ; + proxy_set_header X-Real-IP ; + proxy_set_header X-Forwarded-For ; } - } -} \ No newline at end of file +}