-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
53 lines (39 loc) · 1.25 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
server {
listen 80;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
#proxy_pass http://192.168.151.107:3030/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
upstream backend {
# nginx as a load balancer with proxy
ip_hash;
server 192.168.0.1:31300 weight=5;
server 192.168.0.1:31301 weight=1;
server 192.168.0.1:31302 max_fails=3 fail_timeout=30s weight=1;
}
proxy_cache_path /etc/nginx/cache keys_zone=my_cache:10m max_size=100m inactive=60m use_temp_path=off;
# nginx as a reverse proxy
# this will route our frontend requests to the backend on port 4008
server {
listen 9090;
location / {
proxy_cache my_cache;
proxy_cache_valid 200 30s;
proxy_cache_methods GET HEAD POST;
proxy_cache_min_uses 1;
proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
proxy_pass http://backend;
proxy_redirect off;
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-Host $server_name;
}
}