From 940416c68497bf93e4e3b1814a4cd294eaa57543 Mon Sep 17 00:00:00 2001 From: Sophie Schiller Date: Sat, 7 Aug 2021 20:35:12 +0200 Subject: [PATCH 1/6] bw/nginx add first draft of error page --- data/nginx/files/errorpages/500.html | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 data/nginx/files/errorpages/500.html diff --git a/data/nginx/files/errorpages/500.html b/data/nginx/files/errorpages/500.html new file mode 100644 index 0000000..0e2a2ea --- /dev/null +++ b/data/nginx/files/errorpages/500.html @@ -0,0 +1,19 @@ + + + + Internal Server Error + + + + +
+
+

Internal Server Error

+
+
+

The 500 (Internal Server Error) status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request.

+
+
+ + + -- 2.39.2 From a09953a849caf856e2d62846373e981d019f5a39 Mon Sep 17 00:00:00 2001 From: Sophie Schiller Date: Sat, 7 Aug 2021 20:51:03 +0200 Subject: [PATCH 2/6] bw/nginx let's not use inline css --- data/nginx/files/errorpages/500.html | 36 ++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/data/nginx/files/errorpages/500.html b/data/nginx/files/errorpages/500.html index 0e2a2ea..d02022d 100644 --- a/data/nginx/files/errorpages/500.html +++ b/data/nginx/files/errorpages/500.html @@ -4,14 +4,40 @@ Internal Server Error + -
-
-

Internal Server Error

+
+
+

Internal Server Error

-
-

The 500 (Internal Server Error) status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request.

+
+

The 500 (Internal Server Error) status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request.

-- 2.39.2 From 856c9be73f2c3c780f9b3916a0479dbbc375f7f7 Mon Sep 17 00:00:00 2001 From: Sophie Schiller Date: Sat, 7 Aug 2021 21:22:56 +0200 Subject: [PATCH 3/6] bw/nginx moar fancy css --- data/nginx/files/errorpages/500.html | 84 ++++++++++++++++++---------- 1 file changed, 56 insertions(+), 28 deletions(-) diff --git a/data/nginx/files/errorpages/500.html b/data/nginx/files/errorpages/500.html index d02022d..818cee9 100644 --- a/data/nginx/files/errorpages/500.html +++ b/data/nginx/files/errorpages/500.html @@ -1,43 +1,71 @@ - Internal Server Error + Server Error -
-

Internal Server Error

+

Server Error

-

The 500 (Internal Server Error) status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request.

+

Dieses System ist aktuell nicht verfügbar.

+

This system is currently unavailable.

-- 2.39.2 From ab21983a4f3bbe0e0c8d70dbed7499689a9abf70 Mon Sep 17 00:00:00 2001 From: Sophie Schiller Date: Sat, 7 Aug 2021 21:52:39 +0200 Subject: [PATCH 4/6] 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.

+
+
+ + + -- 2.39.2 From 6e3603553fdf018655e10e8872115a18800e6954 Mon Sep 17 00:00:00 2001 From: Sophie Schiller Date: Sat, 7 Aug 2021 21:59:07 +0200 Subject: [PATCH 5/6] bw/nginx retab everything --- bundles/nginx/files/site_template | 20 ++--- data/nginx/files/error.html | 122 +++++++++++++++--------------- data/nginx/files/not_found.html | 122 +++++++++++++++--------------- 3 files changed, 132 insertions(+), 132 deletions(-) diff --git a/bundles/nginx/files/site_template b/bundles/nginx/files/site_template index 339099c..7d90a43 100644 --- a/bundles/nginx/files/site_template +++ b/bundles/nginx/files/site_template @@ -72,17 +72,17 @@ server { % endif add_header Permissions-Policy interest-cohort=(); - error_page 404 /not_found.html; - location = /not_found.html { - root /var/www/; - internal; - } + 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; - } + error_page 500 502 503 504 /error.html; + location = /error.html { + root /var/www/; + internal; + } % if ssl == 'letsencrypt': location /.well-known/acme-challenge/ { diff --git a/data/nginx/files/error.html b/data/nginx/files/error.html index 818cee9..b06bad3 100644 --- a/data/nginx/files/error.html +++ b/data/nginx/files/error.html @@ -2,72 +2,72 @@ Server Error - + - - + * { + font-family: "Segoe UI", system-ui, "Roboto", "Helvetica Neue", "Arial"; + color: var(--text-color); + margin: 0; + padding: 0; + } + html { + background-color: var(--bg-color); + } + .header{ + border-bottom-width: 10px; + border-bottom-style: solid; + border-bottom-color: var(--line-color); + padding-bottom: 1em + } + h1{ + vertical-align: middle; + margin: 0 auto; + width: var(--page-width); + } + .emoji{ + vertical-align: middle; + font-size: 3em; + margin-right: 0.5em; + } + .text{ + margin: 1em auto; + width: var(--page-width); + font-size: 1.5em; + } + -
-
-

Server Error

-
-
-

Dieses System ist aktuell nicht verfügbar.

-

This system is currently unavailable.

-
-
+
+
+

Server Error

+
+
+

Dieses System ist aktuell nicht verfügbar.

+

This system is currently unavailable.

+
+
diff --git a/data/nginx/files/not_found.html b/data/nginx/files/not_found.html index 6dddbb8..cbb5218 100644 --- a/data/nginx/files/not_found.html +++ b/data/nginx/files/not_found.html @@ -2,72 +2,72 @@ Not Found - + - - + * { + font-family: "Segoe UI", system-ui, "Roboto", "Helvetica Neue", "Arial"; + color: var(--text-color); + margin: 0; + padding: 0; + } + html { + background-color: var(--bg-color); + } + .header{ + border-bottom-width: 10px; + border-bottom-style: solid; + border-bottom-color: var(--line-color); + padding-bottom: 1em + } + h1{ + vertical-align: middle; + margin: 0 auto; + width: var(--page-width); + } + .emoji{ + vertical-align: middle; + font-size: 3em; + margin-right: 0.5em; + } + .text{ + margin: 1em auto; + width: var(--page-width); + font-size: 1.5em; + } + -
-
-

🔦 Not Found

-
-
-

404 - Seite nicht gefunden.

-

404 - Page not found.

-
-
+
+
+

🔦 Not Found

+
+
+

404 - Seite nicht gefunden.

+

404 - Page not found.

+
+
-- 2.39.2 From e8d1582ed4f55e8b0055507fca29bc1e10ad6bfc Mon Sep 17 00:00:00 2001 From: Sophie Schiller Date: Sat, 7 Aug 2021 22:01:40 +0200 Subject: [PATCH 6/6] bw/nginx i hate whitespace --- bundles/nginx/files/site_template | 2 +- data/nginx/files/error.html | 8 ++++---- data/nginx/files/not_found.html | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bundles/nginx/files/site_template b/bundles/nginx/files/site_template index 7d90a43..304e0fc 100644 --- a/bundles/nginx/files/site_template +++ b/bundles/nginx/files/site_template @@ -77,7 +77,7 @@ server { root /var/www/; internal; } - + error_page 500 502 503 504 /error.html; location = /error.html { root /var/www/; diff --git a/data/nginx/files/error.html b/data/nginx/files/error.html index b06bad3..544a586 100644 --- a/data/nginx/files/error.html +++ b/data/nginx/files/error.html @@ -36,23 +36,23 @@ background-color: var(--bg-color); } .header{ - border-bottom-width: 10px; + border-bottom-width: 10px; border-bottom-style: solid; border-bottom-color: var(--line-color); padding-bottom: 1em } h1{ vertical-align: middle; - margin: 0 auto; + margin: 0 auto; width: var(--page-width); } .emoji{ vertical-align: middle; - font-size: 3em; + font-size: 3em; margin-right: 0.5em; } .text{ - margin: 1em auto; + margin: 1em auto; width: var(--page-width); font-size: 1.5em; } diff --git a/data/nginx/files/not_found.html b/data/nginx/files/not_found.html index cbb5218..289b13b 100644 --- a/data/nginx/files/not_found.html +++ b/data/nginx/files/not_found.html @@ -36,23 +36,23 @@ background-color: var(--bg-color); } .header{ - border-bottom-width: 10px; + border-bottom-width: 10px; border-bottom-style: solid; border-bottom-color: var(--line-color); padding-bottom: 1em } h1{ vertical-align: middle; - margin: 0 auto; + margin: 0 auto; width: var(--page-width); } .emoji{ vertical-align: middle; - font-size: 3em; + font-size: 3em; margin-right: 0.5em; } .text{ - margin: 1em auto; + margin: 1em auto; width: var(--page-width); font-size: 1.5em; } -- 2.39.2