-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf
38 lines (31 loc) · 1.47 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
http {
upstream backend {
# Define a list of backend servers to load balance across.
# You can use IP addresses, domain names, or a combination of both.
# Set server weights to define the proportion of traffic each server should receive (optional).
# Simple round-robin load balancing:
server 192.168.74.247:3000; # Replace with your backend server IP/hostname
server 192.168.74.247:3001; # Replace with your backend server IP/hostname
server 192.168.74.247:3002; # Replace with your backend server IP/hostname
# Alternative: With specific weights (higher weight = more traffic):
# server 192.168.1.101 weight=2; # This server will get more traffic
# server 192.168.1.102;
# server 192.168.1.103;
# You can also configure additional settings like max_fails and fail_timeout:
# server 192.168.1.101 max_fails=3 fail_timeout=10s;
# server 192.168.1.102;
# server 192.168.1.103;
}
server {
listen 8080; # Listen on port 80 for HTTP traffic
# Use the defined upstream for load balancing
location / {
proxy_pass http://backend; # Pass incoming requests to the upstream group
proxy_set_header Host $host;
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;
}
}
}
events {}