From ab21983a4f3bbe0e0c8d70dbed7499689a9abf70 Mon Sep 17 00:00:00 2001 From: Sophie Schiller Date: Sat, 7 Aug 2021 21:52:39 +0200 Subject: [PATCH] bw/nginx add not found page and deployment of error pages --- bundles/nginx/files/site_template | 12 +++ bundles/nginx/items.py | 2 + .../files/{errorpages/500.html => error.html} | 0 data/nginx/files/not_found.html | 73 +++++++++++++++++++ 4 files changed, 87 insertions(+) rename data/nginx/files/{errorpages/500.html => error.html} (100%) create mode 100644 data/nginx/files/not_found.html diff --git a/bundles/nginx/files/site_template b/bundles/nginx/files/site_template index 5f3b9c7..339099c 100644 --- a/bundles/nginx/files/site_template +++ b/bundles/nginx/files/site_template @@ -72,6 +72,18 @@ server { % endif add_header Permissions-Policy interest-cohort=(); + error_page 404 /not_found.html; + location = /not_found.html { + root /var/www/; + internal; + } + + error_page 500 502 503 504 /error.html; + location = /error.html { + root /var/www/; + internal; + } + % if ssl == 'letsencrypt': location /.well-known/acme-challenge/ { alias /var/lib/dehydrated/acme-challenges/; diff --git a/bundles/nginx/items.py b/bundles/nginx/items.py index 9ecb69d..88852e0 100644 --- a/bundles/nginx/items.py +++ b/bundles/nginx/items.py @@ -65,6 +65,8 @@ files = { '/usr/local/share/icinga/plugins/check_nginx_status': { 'mode': '0755', }, + '/var/www/error.html': {}, + '/var/www/not_found.html': {}, } if node.has_bundle('pacman'): files['/etc/systemd/system/nginx.service.d/bundlewrap.conf'] = { diff --git a/data/nginx/files/errorpages/500.html b/data/nginx/files/error.html similarity index 100% rename from data/nginx/files/errorpages/500.html rename to data/nginx/files/error.html diff --git a/data/nginx/files/not_found.html b/data/nginx/files/not_found.html new file mode 100644 index 0000000..6dddbb8 --- /dev/null +++ b/data/nginx/files/not_found.html @@ -0,0 +1,73 @@ + + + + Not Found + + + + + + +
+
+

🔦 Not Found

+
+
+

404 - Seite nicht gefunden.

+

404 - Page not found.

+
+
+ + +