-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
41 lines (33 loc) · 1.26 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
events {}
worker_processes auto;
http {
upstream edge_servers {
least_conn; # Use least connections algorithm
server host.docker.internal:3001;
server host.docker.internal:3002;
server host.docker.internal:3003;
}
upstream main_server {
server host.docker.internal:8080; # Main server
}
# Map method to destination
map $request_method $upstream_server {
default http://main_server; # Default to main server
GET http://edge_servers; # GET requests to edge servers
}
server {
listen 80;
location / {
proxy_pass $upstream_server; # Use mapped upstream
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# Access log with cache status for monitoring
# log_format cache_status '$remote_addr - $host [$time_local] '
# '"$request" $status $body_bytes_sent '
# '"$http_referer" "$http_user_agent" '
# 'Cache: $upstream_cache_status';
# access_log /var/log/nginx/access.log cache_status;
}
}