-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
95 lines (81 loc) · 2.45 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
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
http {
# Path to cache folder
proxy_cache_path /etc/nginx/cache/ levels=1:2 keys_zone=STATIC:10m inactive=24h max_size=1g ;
################## These below servers are the proxy servers ###################
# Proxy 1
server {
listen 1111;
location /{
proxy_pass https://www.espncricinfo.com/;
}
}
# Proxy 2
server {
listen 2222;
location /{
proxy_pass https://www.espncricinfo.com/;
}
}
# Proxy 3
server {
listen 3333;
location /{
proxy_pass https://www.espncricinfo.com/;
}
}
# Proxy 4
server {
listen 4444;
location /{
proxy_pass https://www.espncricinfo.com/;
}
}
################### Classifies list of proxy servers to load balance ###################
upstream allbackend {
#### The Default load balancing policy is round robin ####
# Alternatives for Round Robin
# least_conn;
# ip_hash;
server 127.0.0.1:1111;
server 127.0.0.1:2222;
server 127.0.0.1:3333;
server 127.0.0.1:4444;
}
################### Main server which user connects to ###################
# Proxy 0
server {
listen 80;
add_header X-GG-Cache-Status $upstream_cache_status;
location /{
proxy_cache STATIC;
proxy_cache_revalidate on;
proxy_cache_key $scheme$host$proxy_host$request_uri;
proxy_cache_min_uses 0;
proxy_cache_methods GET HEAD POST;
proxy_cache_lock on;
proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
proxy_cache_valid 15m;
proxy_set_header Host $host;
proxy_set_header X-Cache-Status $upstream_cache_status;
proxy_ignore_headers X-Accel-Expires Expires Cache-Control;
proxy_hide_header Set-Cookie;
proxy_ignore_headers Set-Cookie;
proxy_pass http://allbackend/;
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|js|pdf|gz|svg|svgz|mp4|ogg|ogv|webm|html|json|text|xml|xhtml|css|application)$ {
expires 30d;
access_log on;
add_header Pragma "public";
add_header Cache-Control max-age=120000;
proxy_ignore_headers "Set-Cookie";
proxy_ignore_headers Cache-Control;
proxy_cache STATIC;
proxy_cache_valid 200 1d;
proxy_cache_background_update on;
proxy_cache_lock on;
proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
add_header X-Nginx-Cache-Status $upstream_cache_status;
}
}
}
}
events { }