2015-02-01 01:15:41 +00:00
|
|
|
worker_processes ${{NUM_WORKERS}};
|
|
|
|
error_log stderr notice;
|
|
|
|
daemon off;
|
|
|
|
|
2015-02-01 01:27:55 +00:00
|
|
|
env PORT;
|
2015-02-01 04:59:10 +00:00
|
|
|
env GITHUB_TOKEN;
|
2015-02-01 05:13:28 +00:00
|
|
|
env GIT_REV;
|
2015-02-01 07:00:52 +00:00
|
|
|
env MAILGUN_KEY;
|
2015-02-01 01:27:55 +00:00
|
|
|
|
2015-02-01 01:15:41 +00:00
|
|
|
events {
|
|
|
|
worker_connections 1024;
|
|
|
|
}
|
|
|
|
|
|
|
|
http {
|
|
|
|
include mime.types;
|
|
|
|
|
|
|
|
server {
|
|
|
|
listen ${{PORT}};
|
|
|
|
lua_code_cache ${{CODE_CACHE}};
|
|
|
|
|
|
|
|
location / {
|
2015-02-01 05:07:58 +00:00
|
|
|
set $_url "";
|
2015-02-01 01:15:41 +00:00
|
|
|
default_type text/html;
|
|
|
|
content_by_lua '
|
|
|
|
require("lapis").serve("app")
|
|
|
|
';
|
|
|
|
}
|
|
|
|
|
|
|
|
location /static/ {
|
|
|
|
alias static/;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /favicon.ico {
|
|
|
|
alias static/favicon.ico;
|
|
|
|
}
|
2015-02-01 04:59:10 +00:00
|
|
|
|
|
|
|
location /capture {
|
|
|
|
internal;
|
|
|
|
resolver 8.8.8.8;
|
|
|
|
set_unescape_uri $clean_url $arg_url;
|
2015-02-01 05:05:50 +00:00
|
|
|
proxy_pass $clean_url;
|
2015-02-01 04:59:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
";
|
|
|
|
resolver 8.8.8.8;
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
proxy_pass $_url;
|
|
|
|
}
|
2015-02-01 01:15:41 +00:00
|
|
|
}
|
|
|
|
}
|