-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
334 lines (270 loc) · 8.75 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
#user nobody;
worker_processes 1;
daemon off;
master_process off; #off for debug
worker_priority -20;
worker_cpu_affinity 0001;
worker_rlimit_nofile 655350;
#error_log logs/error.log debug;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
#load_module modules/ngx_http_modsecurity_module.so;
events {
use epoll;
worker_connections 100000;
}
thread_pool default threads=1 max_queue=65536;
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'
'"$upstream_addr" "$upstream_cache_status:DIRECT" "$upstream_connect_time" "$upstream_header_time"'
'"$upstream_response_time" "$request_time" ';
access_log logs/access.log main;
sendfile off;
tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 200;
client_header_timeout 200s;
#gzip on;
access_log on;
#urlencode_parse off;
#俄制SQL转为012
# char resp_1024[1024] = "HTTP/1.1 200 OK\r\nContent-Length: 21\r\nContent-Type: text/html; charset=koi8-r\r\n\r\ncccabcSQLghijkldefabc";
#charset_map koi8-r window-1251 {
# 53 30;
# 51 31;
# 4c 32;
#}
upstream log_backend {
server 0.0.0.0:91;
}
#map $status $no_cache_status {
# 302 1;
# 301 1;
# default 0;
#}
map $request_uri $request_uri_path {
"~^(?P<path>[^?]*)(\?.*)?$" $path;
}
#map $content_length $no_cache_cl {
# "^(?:[1-9]\d{0,2}|0)?$"
#}
#proxy_temp_path /usr/local/nginx/proxy_temp;
#proxy_cache_path /usr/local/nginx/cache levels=2:2 keys_zone=kcache:200M inactive=20m max_size=1G purger=on;
#proxy_cache_path /usr/local/nginx/cache levels=2:2 keys_zone=kcache:200M inactive=20m max_size=1G;
#proxy_temp_path /home/kswaf/forward/tengine/proxy_temp;
geo $purge_allowed {
default 0; # deny from other
127.0.0.1 1; # allow from localhost
}
map $request_method $purge_method {
PURGE $purge_allowed;
default 0;
}
server {
#listen 80;
listen 80 reuseport;
server_name localhost;
#override_charset on; #map转换总开关
#charset window-1251; #指定响应给c的字符类型
#client_max_body_size 20m;
client_body_buffer_size 1m;
proxy_buffering off; #nginx针对osvc特有tunnel模型
#off 不会cache
proxy_request_buffering off;
#modsecurity on;
#modsecurity_rules_file /usr/local/nginx/conf/modsecurity.conf;
#subreq_intercept /subreq;
location / {
#limit_rate 100;
#mirror /mirror;
#mirror_request_body on;
#auth_request /auth;
#auth_request_set $user $upstream_http_x_forwarded_user;
proxy_pass http://0.0.0.0:90/;
#more_set_headers "Nak: 1234567890";
#add_header "Nak" "xx1234567890";
#sub_filter 'abb' 'xxb';
#sub_filter 'zzz' 'xxx';
sub_filter 'abc' '111';
#sub_filter '0bb' '0xb';
sub_filter_once off;
sub_filter_types *;
#error_page 405 =200 $request_uri;
#send_log_pass http://127.0.0.1:93/;
#keepalive_timeout 0;
root html;
index index.html index.htm;
}
location /xxx {
root html;
index index.html index.htm;
}
location /200 {
return 200;
}
#location /cache {
# proxy_buffering on;
# #proxy_ignore_headers X-Accel-Buffering;
# proxy_cache kcache;
# proxy_cache_key $scheme$host$request_uri_path;
# proxy_cache_bypass $args;
# proxy_no_cache $args;
# proxy_cache_valid 200 302 10m;
# proxy_cache_valid 404 1m;
# proxy_cache_revalidate off;
# #proxy_cache_purge $purge_method;
# proxy_cache_purge PURGE from 127.0.0.1;
# #proxy_cache_purge PURGE purge_all from 127.0.0.1;
# add_header X-Cache $upstream_cache_status;
# proxy_pass http://127.0.0.1:90;
#}
#location ~ /purge/(.*) {
# allow 127.0.0.1;
# deny all;
# #proxy_cache kcache;
# proxy_cache_purge kcache $1;
#}
#location /1cache {
# proxy_buffering on;
# #proxy_ignore_headers X-Accel-Buffering;
# proxy_cache kcache;
# proxy_cache_key $scheme$proxy_host$request_uri_path;
# proxy_cache_bypass $args;
# proxy_no_cache $args;
# #proxy_cache_valid 200 302 10m;
# #proxy_cache_valid 404 1m;
# #proxy_cache_revalidate off;
# #proxy_cache_purge $purge_method;
# proxy_cache_purge PURGE from 127.0.0.1;
# #proxy_cache_purge PURGE purge_all from 127.0.0.1;
# add_header X-Cache $upstream_cache_status;
# proxy_pass http://127.0.0.1:90;
#}
#location ~ /purge(/.*) {
# allow 127.0.0.1;
# deny all;
# proxy_cache_purge kcache $scheme$proxy_host$1;
#}
location /auth {
internal;
proxy_pass http://log_backend;
}
location /https {
internal;
proxy_pass https://0.0.0.0:443/;
}
location /subreq {
internal;
proxy_pass http://log_backend;
proxy_set_header SUBREQ-URI $request_uri;
}
#location /mirror {
# internal;
# proxy_pass http://log_backend;
# proxy_set_header X-Original-URI $request_uri;
#}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
server {
listen 9529;
server_name localhost;
proxy_buffering off;
location / {
expires 30d;
root html;
index index.html index.htm;
#return 200 'hello world';
return 200;
}
}
#server {
# listen 443 ssl;
# server_name www.test1.com tsl.test1.com;
# ssl_certificate server1.crt;
# ssl_certificate_key server1.key;
# location / {
# root /data/www;
# }
#}
#server {
# listen 443 ssl;
# server_name www.test2.com tsl.test2.com;
# ssl_certificate server2.crt;
# ssl_certificate_key server2.key;
# location / {
# root /data/www;
# }
#}
#map \$ssl_server_name \$sni_string {
# www.test1.com server1;
# www.test2.com server2;
# #default xxx;
#}
#server {
# listen 443 ssl;
# ssl_certificate \${sni_string}.crt;
# ssl_certificate_key \${sni_string}.key;
# location / {
# root /data/www;
# }
#}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
server {
listen 443 ssl;
server_name localhost;
ssl_certificate server.crt;
ssl_certificate_key server.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location /{
return 200;
root html;
index index.html index.htm;
}
}
}