From 37644989606441faec4955f8a54e1de228e585be Mon Sep 17 00:00:00 2001 From: Rmarieta Date: Fri, 12 Jan 2024 17:01:51 +0100 Subject: [PATCH] Disabling HTTPS and switching to Noto port --- docker-compose.yml | 6 ++--- nginx/conf.d/old_server_HTTPS.conf | 38 ++++++++++++++++++++++++++++++ nginx/conf.d/server.conf | 14 ++--------- nginx/nginx.conf | 2 +- 4 files changed, 44 insertions(+), 16 deletions(-) create mode 100644 nginx/conf.d/old_server_HTTPS.conf diff --git a/docker-compose.yml b/docker-compose.yml index 2b31c44..28db090 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -57,12 +57,12 @@ services: image: nginx:latest container_name: nginx ports: - - "80:80" - - "443:443" + - "1015:80" + # - "443:443" volumes: - ./nginx/conf.d:/etc/nginx/conf.d - ./nginx/nginx.conf:/etc/nginx/nginx.conf - - ./nginx/ssl-certs:/etc/nginx/ssl-certs + # - ./nginx/ssl-certs:/etc/nginx/ssl-certs depends_on: - flask_1 - flask_2 diff --git a/nginx/conf.d/old_server_HTTPS.conf b/nginx/conf.d/old_server_HTTPS.conf new file mode 100644 index 0000000..ddfe48f --- /dev/null +++ b/nginx/conf.d/old_server_HTTPS.conf @@ -0,0 +1,38 @@ +server { + listen 80; + server_name localhost; + + # redirect HTTP to HTTPS + return 301 https://$host$request_uri; +} + +upstream flask_nodes { + ip_hash; + + server flask_1:5000; + server flask_2:5000; +} + +server { + listen 443 ssl; + server_name localhost; + + ssl_certificate /etc/nginx/ssl-certs/localhost.crt; + ssl_certificate_key /etc/nginx/ssl-certs/localhost.key; + + location / { + proxy_pass http://flask_nodes/; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Prefix /; + } + + location /socket.io { + proxy_pass http://flask_nodes/socket.io; + proxy_http_version 1.1; + proxy_buffering off; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + } +} diff --git a/nginx/conf.d/server.conf b/nginx/conf.d/server.conf index ddfe48f..14672ef 100644 --- a/nginx/conf.d/server.conf +++ b/nginx/conf.d/server.conf @@ -1,10 +1,3 @@ -server { - listen 80; - server_name localhost; - - # redirect HTTP to HTTPS - return 301 https://$host$request_uri; -} upstream flask_nodes { ip_hash; @@ -14,11 +7,8 @@ upstream flask_nodes { } server { - listen 443 ssl; - server_name localhost; - - ssl_certificate /etc/nginx/ssl-certs/localhost.crt; - ssl_certificate_key /etc/nginx/ssl-certs/localhost.key; + listen 80; + server_name _; location / { proxy_pass http://flask_nodes/; diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 9cc26e2..534e4c3 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -9,5 +9,5 @@ events { http { # include the other config files - include /etc/nginx/conf.d/*.conf; + include /etc/nginx/conf.d/server.conf; } \ No newline at end of file