simplex/nginx.conf

67 lines
1.1 KiB
Nginx Configuration File
Raw Normal View History

2018-04-23 12:02:59 +00:00
worker_processes ${{NUM_WORKERS}};
2018-04-23 13:06:56 +00:00
daemon on;
2018-04-23 12:02:59 +00:00
pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
charset UTF-8;
2018-04-23 12:02:59 +00:00
include mime.types;
server_tokens off;
# blocking non-local requests
geo $bad_client {
default 1;
127.0.0.1 0;
}
2018-04-23 12:02:59 +00:00
server {
listen ${{PORT}};
lua_code_cache ${{CODE_CACHE}};
if ($bad_client) {
return 301 https://${{DOMAIN}}/$request_uri; #permanent
}
2018-04-23 12:02:59 +00:00
location / {
default_type text/html;
set $_url "";
2018-04-23 12:02:59 +00:00
content_by_lua '
require("lapis").serve("app")
';
}
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;
}
2018-04-23 12:02:59 +00:00
location /static/ {
alias static/;
}
location /favicon.ico {
alias static/favicon.ico;
}
}
}