-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathload-balancer.conf
111 lines (93 loc) · 3.45 KB
/
load-balancer.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
worker_processes 4;
worker_rlimit_nofile 40000;
events {
worker_connections 8192;
}
http {
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream rancher_servers_http {
least_conn;
server {IP}:80 max_fails=3 fail_timeout=5s;
}
upstream kubernetes-api {
server {IP}:6443;
}
server {
listen 6443 ssl http2;
server_name apps.example.com;
ssl_certificate /etc/nginx/ssl/tls.crt;
ssl_certificate_key /etc/nginx/ssl/tls.key;
location / {
proxy_ssl_trusted_certificate /etc/nginx/rancher.crt;
proxy_ssl_verify off;
proxy_pass https://kubernetes-api;
proxy_set_header Host apps.example.com;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
listen 443 ssl http2;
client_max_body_size 2G;
# proxy_pass rancher_servers_https;
server_name apps.example.com;
ssl_certificate /etc/nginx/ssl/tls.crt;
ssl_certificate_key /etc/nginx/ssl/tls.key;
location / {
proxy_pass https://{IP};
proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
proxy_ssl_ciphers HIGH:!aNULL:!MD5;
proxy_ssl_trusted_certificate /etc/nginx/rancher.crt;
proxy_ssl_verify off;
proxy_set_header Host $host;
#proxy_set_header Host apps.sub.example.com;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
add_header Access-Control-Allow-Origin "*";
add_header Access-Control-Allow-Credentials true;
}
}
server {
listen 80;
listen [::]:80;
client_max_body_size 2G;
}
upstream rancher_servers_https {
least_conn;
server {IP}:443 max_fails=3 fail_timeout=5s;
}
server {
listen 443 ssl http2;
client_max_body_size 2G;
server_name *.example.com example.com
# proxy_pass rancher_servers_https;
ssl_certificate /etc/nginx/ssl/tls.crt;
ssl_certificate_key /etc/nginx/ssl/tls.key;
location / {
proxy_pass https://rancher_servers_https;
#proxy_ssl_certificate /etc/nginx/ssl/tls.crt;
#proxy_ssl_certificate_key /etc/nginx/ssl/tls.key;
proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
proxy_ssl_ciphers HIGH:!aNULL:!MD5;
proxy_ssl_trusted_certificate /etc/nginx/workers.crt;
proxy_ssl_verify off;
# proxy_ssl_verify_depth 2;
# proxy_ssl_session_reuse on;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
}