-
Notifications
You must be signed in to change notification settings - Fork 37
/
nginx-site.conf
81 lines (63 loc) · 2.76 KB
/
nginx-site.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
proxy_cache_path /var/cache/nginx/main_cache levels=1:2 keys_zone=main_cache:1m max_size=100m inactive=5m use_temp_path=off;
limit_req_zone $binary_remote_addr zone=voting_rate:32m rate=1r/s;
server {
listen 80;
server_name www.bitcoinunlimited.info;
return 301 http://bitcoinunlimited.info$request_uri;
}
proxy_cache_path /var/cache/nginx/main_cache levels=1:2 keys_zone=main_cache:1m max_size=1024m inactive=5m use_temp_path=off;
server {
listen 80;
server_name bitcoinunlimited.info;
location /voting {
index nothing_will_match;
autoindex on;
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;
proxy_pass http://127.0.0.1:9090/api1;
proxy_read_timeout 10;
# enable caching in main_cache defined above
proxy_cache main_cache;
# also cache when buvweb instance is unreachable and timeout is reached,
# or when something's broken on the buvweb side (50x code),
# and simply serve stale content then
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
# lock the cache - serve only one request at a time and cache all others
proxy_cache_lock on;
# cache stuff for 1s - to ensure cache gets filled
proxy_cache_valid 1;
# add header to debug cache functionality. maybe switch off in
# production? shouldn't harm though.
add_header X-Cache-Status $upstream_cache_status;
# limit amounts of requests per IP to keep voting server from being
# hammered
limit_req zone=voting_rate burst=100 nodelay;
}
location /nodes {
return 301 https://cashnodes.io;
}
location / {
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;
proxy_pass http://localhost:8080;
proxy_read_timeout 3;
proxy_redirect http://localhost:8080 http://bitcoinunlimited.info;
# enable caching in main_cache defined above
proxy_cache main_cache;
# cache when node.js instance is unreachable. Note that the timeout
# has been reduced above to a saner 10s.
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
# lock the cache - serve only one request from node.js and cache all others
proxy_cache_lock on;
# force caching of everything for 10s
proxy_ignore_headers Cache-Control;
proxy_cache_valid any 10;
# add header to debug cache functionality. maybe switch off in
# production?
add_header X-Cache-Status $upstream_cache_status;
}
}