-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnginx.conf
61 lines (53 loc) · 2.05 KB
/
nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
events {
}
http {
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream websocket {
server 10.0.12.13:8080;
server 10.0.12.14:8080;
server 10.0.12.15:8080;
}
#https://docs.nginx.com/nginx/deployment-guides/node-js-load-balancing-nginx-plus/#websocket
upstream guacamoleservers {
# Clients with the same IP are redirected to the same backend
ip_hash;
server guacamole:8080;
#server guacamole2:8080;
}
resolver 127.0.0.11 valid=10s;
server {
listen 80 default_server;
server_name _;
return 301 https://$host$request_uri;
}
server {
#listen 80;
listen 443 ssl;
ssl_certificate /etc/nginx/conf.d/cert.pem;
ssl_certificate_key /etc/nginx/conf.d/key.pem;
location /guacamole/ {
set $backend_servers guacamole;
# proxy_pass http://$backend_servers:8080/guacamole/;
# proxy_pass http://10.0.12.13:8080/guacamole/;
# proxy_pass http://websocket/guacamole/;
# proxy_pass http://guacamole:8080/guacamole/;
proxy_pass http://guacamoleservers/guacamole/;
proxy_buffering off;
proxy_http_version 1.1;
# https://www.nginx.com/resources/wiki/start/topics/examples/forwarded/
# NGINX even provides a $proxy_add_x_forwarded_for variable to automatically append $remote_addr to any incoming X-Forwarded-For headers.
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# Addon header that is queried to learn the IP address of the proxy server that forwarded the request
#proxy_set_header X-Forwarded-By $server_addr:$server_port;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
#proxy_set_header Connection "Upgrade";
access_log off;
# Increase default file transfer size from 1 MB
client_max_body_size 25m;
}
}
}