From cb9fdedb1e473bbe99f7e6c3e42564f2de355d3a Mon Sep 17 00:00:00 2001 From: zeus Date: Sat, 21 Nov 2020 15:34:53 +0200 Subject: [PATCH] set --- nginx/swarmlab-proxy-server.conf | 65 ++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 nginx/swarmlab-proxy-server.conf diff --git a/nginx/swarmlab-proxy-server.conf b/nginx/swarmlab-proxy-server.conf new file mode 100644 index 0000000..7a7a28c --- /dev/null +++ b/nginx/swarmlab-proxy-server.conf @@ -0,0 +1,65 @@ +upstream factory_servers { + server localhost:3000; +} +proxy_cache_path /var/tmp levels=1:2 keys_zone=my_cache:10m max_size=10g inactive=60m use_temp_path=off; +server { + listen 80; + server_name factory.swarmlab.io; + return 301 https://factory.swarmlab.io$request_uri; +} +server { + listen 443 ssl; + server_name factory.swarmlab.io; + + # To allow special characters in headers + ignore_invalid_headers off; + # Allow any size file to be uploaded. + # Set to a value such as 1000m; to restrict file size to a specific value + client_max_body_size 0; + # To disable buffering + proxy_buffering off; + + ssl_certificate /etc/nginx/fullchain.pem; + ssl_certificate_key /etc/nginx/key.private.pem; + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; + ssl_ciphers HIGH:!aNULL:!MD5; + + + location / { + proxy_cache my_cache; + 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_set_header Host $http_host; + + proxy_set_header X-NginX-Proxy true; + proxy_ssl_session_reuse off; + proxy_redirect off; + + proxy_connect_timeout 300; + # Default is HTTP/1, keepalive is only enabled in HTTP/1.1 + proxy_http_version 1.1; + proxy_set_header Connection ""; + chunked_transfer_encoding off; + + #proxy_pass http://minio1:9000; # If you are using docker-compose this would be the hostname i.e. minio + proxy_pass http://factory_servers; + # Health Check endpoint might go here. See https://www.nginx.com/resources/wiki/modules/healthcheck/ + # /minio/health/live; + } + + # Requests for socket.io are passed on to Node on port 3000 + location ~* \.io { + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $http_host; + proxy_set_header X-NginX-Proxy false; + + proxy_pass http://factory_servers; + proxy_redirect off; + + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + } +}