79 lines
2.1 KiB
Nginx Configuration File
79 lines
2.1 KiB
Nginx Configuration File
worker_processes auto;
|
|
error_log /var/log/nginx/error.log warn;
|
|
pid /tmp/nginx.pid;
|
|
|
|
events {
|
|
worker_connections 1024;
|
|
}
|
|
|
|
http {
|
|
include /etc/nginx/mime.types;
|
|
default_type text/html;
|
|
sendfile on;
|
|
server_tokens off;
|
|
charset utf-8;
|
|
|
|
map $http_upgrade $connection_upgrade {
|
|
default upgrade;
|
|
"" close;
|
|
}
|
|
|
|
map $status $error_title {
|
|
default "Service Unavailable";
|
|
502 "Bad Gateway";
|
|
503 "Service Unavailable";
|
|
504 "Gateway Timeout";
|
|
}
|
|
|
|
include /etc/nginx/upstreams.map;
|
|
|
|
server {
|
|
listen 127.0.0.1:4098;
|
|
server_name _;
|
|
|
|
root /usr/share/nginx/html;
|
|
absolute_redirect off;
|
|
|
|
location = /healthz {
|
|
access_log off;
|
|
default_type text/plain;
|
|
return 200 "ok\n";
|
|
}
|
|
|
|
error_page 502 503 504 /__error/index.html;
|
|
|
|
location = /__error/index.html {
|
|
internal;
|
|
sub_filter_once off;
|
|
sub_filter_types text/html;
|
|
sub_filter "__STATUS__" $status;
|
|
sub_filter "__ERROR_TITLE__" $error_title;
|
|
sub_filter "__HOST__" $host;
|
|
add_header Cache-Control "no-store" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
}
|
|
|
|
location / {
|
|
if ($app_port = 0) {
|
|
return 502;
|
|
}
|
|
|
|
proxy_pass http://127.0.0.1:$app_port;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
|
|
proxy_connect_timeout 3s;
|
|
proxy_send_timeout 3600s;
|
|
proxy_read_timeout 3600s;
|
|
|
|
# Only replace DSM-style "upstream down" pages. App 404/500 stay as-is.
|
|
proxy_intercept_errors on;
|
|
}
|
|
}
|
|
}
|