-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathnginx.conf
51 lines (47 loc) · 1.32 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
user www-data;
worker_processes 1;
error_log /var/log/nginx/error.log error;
pid /var/run/nginx.pid;
events {
worker_connections 61440;
}
http {
access_log off;
lua_shared_dict ngx_stats 10m;
lua_package_path '/etc/nginx/lua/?.lua;;';
lua_package_cpath '/etc/nginx/lua/?.so;;';
init_by_lua_file /etc/nginx/lua/stats/init.lua;
proxy_cache_path /var/tmp/cache_http levels=1:1:1
keys_zone=g_cache:64m
max_size=1024m inactive=4h;
server {
listen 80;
server_name example.com;
set $stats_group "example.com";
log_by_lua_file /etc/nginx/lua/stats/log.lua;
location / {
proxy_pass "http://127.0.0.1:8080";
proxy_cache g_cache;
}
location = /status.json {
default_type 'application/json';
content_by_lua_file /etc/nginx/lua/stats/show.lua;
}
}
server {
listen 80;
server_name sub.example.com;
set $stats_group "sub.example.com";
log_by_lua_file /etc/nginx/lua/stats/log.lua;
location / {
proxy_pass "http://127.0.0.1:8081";
proxy_cache g_cache;
}
}
server {
listen 80 default_server;
server_name _;
log_by_lua_file /etc/nginx/lua/stats/log.lua;
return 404;
}
}