forked from mempool/mempool
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
123 lines (112 loc) · 2.3 KB
/
nginx.conf
File metadata and controls
123 lines (112 loc) · 2.3 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
user nobody;
pid /var/run/nginx.pid;
worker_processes auto;
worker_rlimit_nofile 100000;
events {
worker_connections 9000;
multi_accept on;
}
http {
# HTTP basic configuration
include /etc/nginx/http-basic.conf;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# proxy cache
proxy_cache off;
proxy_cache_path /var/cache/nginx keys_zone=cache:20m levels=1:2 inactive=600s max_size=500m;
types_hash_max_size 2048;
# exempt localhost from rate limit
geo $limited_ip {
default 1;
127.0.0.1 0;
}
map $limited_ip $limited_ip_key {
1 $binary_remote_addr;
0 '';
}
# rate limit requests
limit_req_zone $limited_ip_key zone=api:5m rate=200r/m;
limit_req_zone $limited_ip_key zone=electrs:5m rate=2000r/m;
limit_req_status 429;
# rate limit connections
limit_conn_zone $limited_ip_key zone=websocket:10m;
limit_conn_status 429;
map $http_accept_language $header_lang {
default en-US;
~*^en-US en-US;
~*^en en-US;
~*^ar ar;
~*^cs cs;
~*^da da;
~*^de de;
~*^es es;
~*^fa fa;
~*^fr fr;
~*^ko ko;
~*^it it;
~*^he he;
~*^ka ka;
~*^hu hu;
~*^mk mk;
~*^nl nl;
~*^ja ja;
~*^nb nb;
~*^pl pl;
~*^pt pt;
~*^ro ro;
~*^ru ru;
~*^sl sl;
~*^fi fi;
~*^sv sv;
~*^th th;
~*^tr tr;
~*^uk uk;
~*^vi vi;
~*^zh zh;
~*^hi hi;
~*^ne ne;
~*^lt lt;
~*^hr hr;
}
map $cookie_lang $lang {
default $header_lang;
~*^en-US en-US;
~*^en en-US;
~*^ar ar;
~*^cs cs;
~*^da da;
~*^de de;
~*^es es;
~*^fa fa;
~*^fr fr;
~*^ko ko;
~*^it it;
~*^he he;
~*^ka ka;
~*^hu hu;
~*^mk mk;
~*^nl nl;
~*^ja ja;
~*^nb nb;
~*^pl pl;
~*^pt pt;
~*^ro ro;
~*^ru ru;
~*^sl sl;
~*^fi fi;
~*^sv sv;
~*^th th;
~*^tr tr;
~*^uk uk;
~*^vi vi;
~*^zh zh;
~*^hi hi;
~*^ne ne;
~*^lt lt;
~*^hr hr;
}
server {
listen 127.0.0.1:80;
include /etc/nginx/nginx-mempool.conf;
}
}