Files
error-page/nginx.conf
T
2026-08-18 14:14:02 +09:00

75 lines
1.9 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";
404 "Not Found";
500 "Internal Server Error";
502 "Bad Gateway";
503 "Service Unavailable";
504 "Gateway Timeout";
}
map $status $error_message {
default "We're working to resolve the issue.<br />Please try again shortly.";
404 "The page you're looking for could not be found.";
}
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 404 500 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 "__ERROR_MESSAGE__" $error_message;
sub_filter "__HOST__" $host;
add_header Cache-Control "no-store" always;
add_header X-Content-Type-Options "nosniff" always;
}
# API 404 stays with the app so JSON clients keep working.
location /api/ {
error_page 500 502 503 504 /__error/index.html;
include /etc/nginx/proxy_to_app.conf;
}
location / {
include /etc/nginx/proxy_to_app.conf;
}
}
}