-
Notifications
You must be signed in to change notification settings - Fork 0
/
tpl.static.conf
46 lines (35 loc) · 1.1 KB
/
tpl.static.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
init_by_lua_file "{{ .Env.IMAGES_PWD }}/app/init_static.lua";
lua_check_client_abort on;
lua_malloc_trim 300;
server {
lua_code_cache {{ .Env.LUA_CODE_CACHE }};
listen 80 backlog=65535 default_server;
server_name _;
resolver {{ .Env.RESOLVER }};
client_max_body_size 1m;
client_body_buffer_size 128k;
# set vars
set $content_pwd "{{ .Env.CONTENT_PWD }}";
set $weserv_root "{{ .Env.IMAGES_PWD }}";
set $template_root "{{ .Env.IMAGES_PWD }}/app/views";
root $content_pwd;
#allow connection from all hosts
add_header 'Access-Control-Allow-Origin' '*';
# static content like pdf, doc, js, css, and other text
location ~* \.(js|css|pdf|doc|docx|xls|xlsx|ico)$ {
expires 7d;
try_files $uri =404;
}
# parsing all type of images
location ~ ^/(?<path>.*\.(?<ext>[a-zA-Z_]*))$ {
content_by_lua_file $weserv_root/app/main.lua;
}
location / {
content_by_lua_file $weserv_root/app/main.lua;
}
# deny access to hidden files
#
location ~ /\.(ht|svn|git) {
deny all;
}
}