-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf
86 lines (75 loc) · 2.14 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
env LAZULI_ENVIRONMENT=${{ENVMODE}};
env LUA_PATH="${{ENV_LUA_PATH}}";
env LUA_CPATH="${{ENV_LUA_CPATH}}";
env MOON_PATH="${{ENV_MOON_PATH}}";
worker_processes ${{NUM_WORKERS}};
error_log stderr notice;
daemon ${{RUN_DAEMON}};
events {
worker_connections 1024;
}
http {
include mime.types;
lua_shared_dict page_cache ${{PAGE_CACHE_SIZE}};
server {
listen ${{PORT}};
lua_code_cache ${{CODE_CACHE}};
location / {
set $_url "";
default_type text/html;
content_by_lua '
require "luarocks.loader"
require "moonscript"
function require (name)
if not package.loaded[name] then
local msg, loader = {}
for _, searcher in ipairs(package.loaders) do
local res = searcher(name)
if type(res) == "function" then loader = res; break end
if type(res) == "string" then msg[#msg + 1] = res end
end
if loader == nil then
error("module " .. name .. " not found: "..table.concat(msg), 2)
end
package.loaded[name] = true
local res = loader(name)
if res ~= nil then
package.loaded[name] = res
end
end
return package.loaded[name]
end
require("lapis").serve("app")
';
}
location /static/ {
alias static/;
}
location ~* ^/favicon.* {
rewrite ^/(.*)$ static/img/favicon/$1 permanent;
}
location /_lazuli/license.md {
alias LICENSE.md;
}
location /proxy {
internal;
rewrite_by_lua "
local req = ngx.req
for k,v in pairs(req.get_headers()) do
if k ~= 'content-length' then
req.clear_header(k)
end
end
if ngx.ctx.headers then
for k,v in pairs(ngx.ctx.headers) do
req.set_header(k, v)
end
end
req.set_header('User-Agent','lazuli/nonchip.de')
";
resolver 8.8.8.8;
proxy_http_version 1.1;
proxy_pass $_url;
}
}
}