simplex/nginx.conf
2018-04-24 06:54:56 -07:00

67 lines
1.1 KiB
Nginx Configuration File

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