-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
42 lines (34 loc) · 1.18 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
events { worker_connections 1024; }
# no dirctives = round robin
#least_conn; = send to server with the least load
# ip_hash; = keep each initial connection to the same server based on IP Address
# server server1:80 weight=2; twice the load on server1
http {
upstream app_servers { # Create an upstream for the web servers
least_conn;
server server1:80; # the first server
server server2:80; # the second server
server server3:80; # the third server
server server4:80; # the fourth server
}
server {
listen 80;
listen [::]:80;
listen 443 ssl;
listen [::]:443 ssl;
http2 on;
ssl_certificate /etc/nginx/fullchain.pem;
ssl_certificate_key /etc/nginx/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
server_name YOUR-DOMAIN.TLD;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_pass http://app_servers;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
}