per aspergera ad astra
2026-07-21
simple nginx error page
error.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>
<!--# echo var="status" default="" -->
<!--# echo var="status_text" default="something goes wrong" -->
</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="
<!--# echo var="status" default="" -->
<!--# echo var="status_text" default="something goes wrong" -->
">
<meta http-equiv="content-security-policy"
content="default-src 'nonce-00000000000000000000000000000000' 'unsafe-inline';
base-uri 'none'">
<style nonce="00000000000000000000000000000000">
body
{
color: #000;
background-color: #ddd;
font-family: sans-serif;
font-size: 16px;
}
h1
{
min-height: 80vh;
font-size: 70px;
display: flex;
justify-content: center;
align-items: center;
overflow-wrap: anywhere;
}
@media ( prefers-color-scheme: dark )
{
body
{
color: #ccc;
background-color: #111;
}
}
.red { border: 1px dotted #f00; }
</style>
</head>
<body>
<h1>
<!--# echo var="status" default="" -->
<!--# echo var="status_text" default="something goes wrong" -->
</h1>
</body>
</html>
place into /usr/local/www/internal (or elsewhere (into "root"))
error.conf
error_page 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416
417 418 421 422 423 424 425 426 428 429 431 451 500 501 502 503 504 505 506 507
508 510 511 /error.html;
location = /error.html
{
ssi on;
internal;
auth_basic off;
root /usr/local/www/internal;
}
place into /usr/local/etc/nginx/nginx.conf (nginx config dir on fbsd, choose another at your will) and include, e.g., from server { } block
server
{
#
# ...
#
include error.conf;
#
# ...
#
}
created [1784625757] 2026-07-21 12:22:37 +0300/EEST, modified [1784627135] 2026-07-21 12:45:35 +0300/EEST