-
Notifications
You must be signed in to change notification settings - Fork 42
/
nginx.conf
161 lines (123 loc) · 3.66 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
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
worker_processes 1;
worker_rlimit_nofile 1000;
events {
worker_connections 1000;
}
pid nginx.pid;
error_log logs/error.log debug;
http {
default_type application/octet-stream;
upstream memcached_upstream {
server 127.0.0.1:11211;
keepalive 20;
}
server {
listen 127.0.0.1:8086;
server_name ~^(?<real_host>.*).put$;
location / {
set $enhanced_memcached_key "$request_uri";
set $enhanced_memcached_expire $http_memcached_expire;
set $enhanced_memcached_use_add $http_memcached_use_add;
set $enhanced_memcached_key_namespace "$real_host";
enhanced_memcached_hash_keys_with_md5 on;
enhanced_memcached_allow_put on;
enhanced_memcached_allow_delete on;
enhanced_memcached_pass memcached_upstream;
}
location /stats {
enhanced_memcached_stats on;
enhanced_memcached_pass memcached_upstream;
access_log off;
}
location /flushns {
set $enhanced_memcached_key "$request_uri";
set $enhanced_memcached_key_namespace "$real_host";
enhanced_memcached_flush_namespace on;
enhanced_memcached_pass memcached_upstream;
}
location /flush {
enhanced_memcached_flush on;
enhanced_memcached_pass memcached_upstream;
}
}
server {
listen 127.0.0.1:8086;
server_name ~^(?<real_host>.*)$;
gzip on;
gzip_proxied any;
gzip_http_version 1.0;
gzip_comp_level 5;
gzip_types text/plain text/css application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript application/atom+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype;
gzip_vary on;
if ($request_method != GET) {
return 404;
}
if ($http_pragma ~* "no-cache") {
return 404;
}
if ($http_cache_control ~* "no-cache") {
return 404;
}
location / {
set $enhanced_memcached_key "$request_uri";
set $enhanced_memcached_key_namespace "$real_host";
enhanced_memcached_hash_keys_with_md5 on;
enhanced_memcached_pass memcached_upstream;
}
}
server {
listen 127.0.0.1:8087;
server_name ~^(?<real_host>.*).put$;
location / {
set $enhanced_memcached_key "$request_uri";
set $enhanced_memcached_expire $http_memcached_expire;
set $enhanced_memcached_use_add $http_memcached_use_add;
enhanced_memcached_hash_keys_with_md5 on;
enhanced_memcached_allow_put on;
enhanced_memcached_allow_delete on;
enhanced_memcached_pass memcached_upstream;
}
location /stats {
enhanced_memcached_stats on;
enhanced_memcached_pass memcached_upstream;
access_log off;
}
location /flush {
enhanced_memcached_flush on;
enhanced_memcached_pass memcached_upstream;
}
}
server {
error_page 404 502 = @fallback;
listen 127.0.0.1:8087;
server_name ~^(?<real_host>.*)$;
gzip on;
gzip_proxied any;
gzip_http_version 1.0;
gzip_comp_level 5;
gzip_types text/plain text/css application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript application/atom+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype;
gzip_vary on;
if ($request_method != GET) {
return 404;
}
if ($http_pragma ~* "no-cache") {
return 404;
}
if ($http_cache_control ~* "no-cache") {
return 404;
}
location / {
set $enhanced_memcached_key "$request_uri";
enhanced_memcached_hash_keys_with_md5 on;
enhanced_memcached_pass memcached_upstream;
}
location @fallback {
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_pass http://127.0.0.1:8089;
}
}
server {
listen 127.0.0.1:8089;
}
}