-
Notifications
You must be signed in to change notification settings - Fork 3
/
nginx.conf
91 lines (86 loc) · 2.63 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
worker_processes 1;
error_log logs/error.log debug;
events {
worker_connections 1024;
}
http {
lua_package_path "/usr/local/openresty/site/lualib/luawiki/?.lua;;";
lua_shared_dict cache_dict 1m;
lua_shared_dict ipc_dict 1m;
init_by_lua_block {
require('lpeg')
require('mw')
require('luawiki/local_settings')
}
server {
listen 6699;
gzip on;
gzip_types text/javascript application/json;
gzip_min_length 1000;
location = / {
rewrite ^ /wiki/Wikipedia:首页 redirect;
}
location /wiki/ {
rewrite ^/wiki/(.*) /w/index.php?title=$1 last;
}
location /w/index.php {
lua_code_cache off;
default_type 'text/html';
content_by_lua_file luawiki/index.lua;
}
location ~ \.css {
default_type 'text/css';
}
location ~ \.js {
default_type 'text/javascript';
}
location ~ \.svg {
default_type 'image/svg+xml';
}
location = /register {
lua_code_cache off;
default_type 'application/json';
content_by_lua_file luawiki/register.lua;
}
location = /login {
lua_code_cache off;
default_type 'application/json';
content_by_lua_file luawiki/login.lua;
}
location = /logout {
lua_code_cache off;
default_type 'application/json';
content_by_lua_file luawiki/logout.lua;
}
location /csrf {
lua_code_cache off;
default_type 'application/json';
content_by_lua_file luawiki/csrf.lua;
}
location ~ ^/page/html/([^/]*)$ {
lua_code_cache off;
default_type 'application/json';
content_by_lua_file luawiki/get_html.lua;
}
location ~ ^/page/wikitext/([^/]*)$ {
lua_code_cache off;
default_type 'application/json';
content_by_lua_file luawiki/page_wikitext.lua;
}
location ~ ^/preview/([^/]*)$ {
lua_code_cache off;
default_type 'application/json';
content_by_lua_file luawiki/preview.lua;
}
location ~ ^/history/([^/]+)(?:/([^/]+))?(?:/([^/]+))? {
lua_code_cache off;
default_type 'application/json';
content_by_lua_file luawiki/history.lua;
}
location /test {
lua_code_cache off;
default_type 'application/json';
content_by_lua_file luawiki/test.lua;
}
}
}