diff --git a/nginx/swarmlab-stats-proxy-server.conf b/nginx/swarmlab-stats-proxy-server.conf new file mode 100644 index 0000000..192c9e1 --- /dev/null +++ b/nginx/swarmlab-stats-proxy-server.conf @@ -0,0 +1,76 @@ +upstream factory_servers { + #ip_hash; + server 127.0.0.1:8080; + #server readmongo:3000; + keepalive 64; +} + +proxy_cache_path /var/tmp levels=1:2 keys_zone=my_cache:10m max_size=10g inactive=60m use_temp_path=off; +resolver_timeout 5s; +server { + listen 80; + listen [::]:80 ipv6only=on; + server_name factory.swarmlab.io; + return 301 https://factory.swarmlab.io$request_uri; +} + +server { + listen [::]:443 ssl ipv6only=off; + 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; + + +# # 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"; +# } + + location / { + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Host $http_host; + proxy_set_header X-NginX-Proxy false; + + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + + #set $originaddr http://factory_servers; + #proxy_pass $originaddr; +# or even +# proxy_pass http://origin.example.com$request_uri; + + proxy_pass http://factory_servers$request_uri; + +# proxy_pass http://factory_servers; +# proxy_pass http://$host; + + proxy_redirect off; + proxy_read_timeout 240s; + } + + +}