feat: add custom nginx 404 page

This commit is contained in:
nyan404 committed 2026-08-25 13:39:28 +03:00
1 parent cf4d9fdd68
commit c838cb8410
4 files changed
+39

No files matched your search

@@ -278,3 +278,11 @@ Proudly made by Nyan404 | GitLab Page
```
Надпись `GitLab Page` должна быть ссылкой на `https://git.nyan404.ru/nyan404/cwshed-clone`.
## 13. Единая страница NGINX для ошибки 404
**Статус:** выполнено в текущей очереди исправлений.
**Источник:** сообщение пользователя от 25.08.2026.
**Требование:** NGINX должен возвращать для несуществующей страницы пользовательскую страницу 404 с предоставленным изображением и подписью: «Картинка позаимствована с основного сайта catwar.net». Ошибка должна сохранять HTTP-статус 404.
+10
View File
@@ -52,6 +52,7 @@ http {
# legacy CatWar static site at /, but forward calculator pages and
# their root-relative API calls to the Belki MetalLB service.
location = /belki {
proxy_intercept_errors on;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@@ -60,6 +61,7 @@ http {
}
location = /belki/ {
proxy_intercept_errors on;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@@ -68,6 +70,7 @@ http {
}
location = /admin {
proxy_intercept_errors on;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@@ -76,6 +79,7 @@ http {
}
location = /applications {
proxy_intercept_errors on;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@@ -84,6 +88,7 @@ http {
}
location = /applications/ {
proxy_intercept_errors on;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@@ -114,6 +119,11 @@ http {
charset utf-8;
}
error_page 404 /404.html;
location = /404.html {
internal;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

+21
View File
@@ -0,0 +1,21 @@
<!doctype html>
<html lang="ru">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Страница не найдена</title>
<style>
:root { color-scheme: light; font-family: Georgia, "Times New Roman", serif; color: #161616; background: #fff; }
body { min-height: 100vh; margin: 0; display: grid; place-items: center; padding: 24px; }
main { width: min(800px, 100%); text-align: center; }
img { display: block; width: 100%; height: auto; }
footer { margin-top: 18px; color: #625d57; font: 0.9rem/1.5 "Trebuchet MS", ui-sans-serif, sans-serif; }
</style>
</head>
<body>
<main>
<img src="/404-cat.png" alt="Кот с веником на странице ошибки 404">
<footer>Картинка позаимствована с основного сайта catwar.net</footer>
</main>
</body>
</html>