-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
nginx.conf.tpl
122 lines (99 loc) · 2.71 KB
/
nginx.conf.tpl
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
daemon off;
worker_processes {* worker_processes *};
pid nginx.pid;
pcre_jit on;
{% for _, line in ipairs(error_log) do %}
error_log {* line *};
{% end %}
events {
{% if worker_connections then %}
worker_connections {* worker_connections *};
{% end %}
}
env TINYSTASH_CONFIG_PATH;
http {
server_tokens off;
sendfile on;
absolute_redirect off;
resolver {* resolver *};
lua_ssl_trusted_certificate {* lua_ssl_trusted_certificate *};
lua_ssl_verify_depth {* lua_ssl_verify_depth *};
lua_package_path "$prefix/resty_modules/lualib/?.lua;$prefix/resty_modules/lualib/?/init.lua;$prefix/?.lua;$prefix/?/init.lua;;";
lua_package_cpath "$prefix/resty_modules/lualib/?.so;;";
init_by_lua_block {
{% if resty_http_debug_logging then %}
require('resty.http').debug(true)
{% end %}
collectgarbage('collect')
}
server {
listen {* listen *};
access_log {* access_log *};
lua_code_cache {* lua_code_cache *};
default_type text/html;
client_max_body_size 8k;
error_page 400 403 404 405 411 413 500 501 502 /error;
location /static/ {
alias ./static/;
try_files $uri =404;
include {* OPENRESTY_PREFIX *}/nginx/conf/mime.types;
}
location = /favicon.ico {
alias ./static/favicon.ico;
default_type image/vnd.microsoft.icon;
}
location = / {
content_by_lua_block {
require('app.views').main()
}
}
location ~ ^/donate/?$ {
content_by_lua_block {
require('app.views').donate()
}
}
location ~ ^/docs/api/?$ {
content_by_lua_block {
require('app.views').docs_api()
}
}
location ~ ^/(?P<mode>dl|il|ln)/(?P<tiny_id>[a-zA-Z0-9]+)(?:\.[a-zA-Z0-9_.]+|/(?P<file_name>[^\\/]+))?/?$ {
content_by_lua_block {
require('app.views').get_file(ngx.var.tiny_id, ngx.var.mode, ngx.var.file_name)
}
}
location ~ ^/webhook/(?P<secret>[a-zA-Z0-9:_-]+)/?$ {
client_max_body_size 256k;
content_by_lua_block {
require('app.views').webhook(ngx.var.secret)
}
}
location ~ ^/upload/?$ {
return 308 /upload/file;
}
location ~ ^/upload/(?P<type>file|text)/?$ {
client_max_body_size {* client_max_body_size *};
content_by_lua_block {
require('app.views').upload(ngx.var.type)
}
}
location ~ ^/upload/url/?$ {
client_max_body_size 8k;
content_by_lua_block {
require('app.views').upload('url')
}
}
location / {
return 404;
}
location /error {
internal;
content_by_lua_block {
require('app.views').error()
}
}
header_filter_by_lua_block {
require('app.phases.header_filter').deny_page_framing()
}
}
}