-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathnginx.conf
81 lines (64 loc) · 1.16 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
worker_processes 1;
error_log stderr info;
events {
worker_connections 1024;
}
http{
lua_shared_dict stat_dict 1M;
lua_package_path '$prefix/?.lua;;';
server {
listen 80 default_server;
root static;
location /show_stat {
autoindex on;
rewrite ^/show_stat/(.*)$ /$1 break;
}
location /stat {
content_by_lua_file 'show_stat.lua';
}
location ~ ^/(\d*)$ {
set $stat_counter $1;
proxy_pass http://0.0.0.0/get/$1;
log_by_lua_file 'collect_stats.lua';
}
location /get {
return 200;
}
location /get/105 {
return 105;
}
location /get/204 {
return 204;
}
location /get/302 {
return 302;
}
location /get/404 {
return 404;
}
location /get/500 {
return 500;
}
location /get/0 {
return 200;
}
location /get/02 {
content_by_lua '
ngx.sleep(0.2)
ngx.say("Yay!")
';
}
location /get/06 {
content_by_lua '
ngx.sleep(0.6)
ngx.say("Yay!")
';
}
location /get/1 {
content_by_lua '
ngx.sleep(1)
ngx.say("Yay!")
';
}
}
}