From 44d62a49b15d0d5859968c60488d18991bff1892 Mon Sep 17 00:00:00 2001 From: Miraty Date: Thu, 16 Feb 2023 23:10:25 +0100 Subject: [PATCH] Move HTTP error pages to the core repository --- install/nginx/inc/errors.conf | 32 ++++++++++++++-------- install/nginx/sites/default-server.conf | 6 +--- install/nginx/sites/http.conf | 6 ++-- srv/servnest/errors/400.html | 15 ---------- srv/servnest/errors/403.html | 15 ---------- srv/servnest/errors/404.en.html | 19 ------------- srv/servnest/errors/404.fr.html | 19 ------------- srv/servnest/errors/404.php | 18 ------------ srv/servnest/errors/405.html | 15 ---------- srv/servnest/errors/410.html | 15 ---------- srv/servnest/errors/418.html | 15 ---------- srv/servnest/errors/500.html | 19 ------------- srv/servnest/errors/502.html | 19 ------------- srv/servnest/errors/503.html | 19 ------------- srv/servnest/errors/504.html | 19 ------------- srv/servnest/errors/default-domain.en.html | 15 ---------- srv/servnest/errors/default-ip.en.html | 15 ---------- srv/servnest/errors/http.php | 21 -------------- srv/servnest/errors/index.php | 8 ------ srv/servnest/errors/unsecure.en.php | 23 ---------------- srv/servnest/errors/unsecure.fr.php | 23 ---------------- 21 files changed, 25 insertions(+), 331 deletions(-) delete mode 100644 srv/servnest/errors/400.html delete mode 100644 srv/servnest/errors/403.html delete mode 100644 srv/servnest/errors/404.en.html delete mode 100644 srv/servnest/errors/404.fr.html delete mode 100644 srv/servnest/errors/404.php delete mode 100644 srv/servnest/errors/405.html delete mode 100644 srv/servnest/errors/410.html delete mode 100644 srv/servnest/errors/418.html delete mode 100644 srv/servnest/errors/500.html delete mode 100644 srv/servnest/errors/502.html delete mode 100644 srv/servnest/errors/503.html delete mode 100644 srv/servnest/errors/504.html delete mode 100644 srv/servnest/errors/default-domain.en.html delete mode 100644 srv/servnest/errors/default-ip.en.html delete mode 100644 srv/servnest/errors/http.php delete mode 100644 srv/servnest/errors/index.php delete mode 100644 srv/servnest/errors/unsecure.en.php delete mode 100644 srv/servnest/errors/unsecure.fr.php diff --git a/install/nginx/inc/errors.conf b/install/nginx/inc/errors.conf index ab82928..ffc77ff 100644 --- a/install/nginx/inc/errors.conf +++ b/install/nginx/inc/errors.conf @@ -3,7 +3,7 @@ recursive_error_pages on; # 403 Forbidden error_page 403 @403; location @403 { - root /srv/servnest/errors; + root /srv/servnest/core/http-errors; try_files /403.html =500; } @@ -13,7 +13,7 @@ location @local404 { try_files /404.html /404.md /404.gmi @servnest404; } location @servnest404 { - root /srv/servnest/errors; + root /srv/servnest/core/http-errors; try_files /404.php =500; index /404.php; fastcgi_split_path_info ^(.+\.php)(/.+)$; @@ -25,48 +25,58 @@ location @servnest404 { # 405 Method Not Allowed error_page 405 @405; location @405 { - root /srv/servnest/errors; + root /srv/servnest/core/http-errors; try_files /405.html =500; } # 410 Gone error_page 410 @410; location @410 { - root /srv/servnest/errors; + root /srv/servnest/core/http-errors; try_files /410.html =500; } # 418 I'm a teapot error_page 418 @418; location @418 { - root /srv/servnest/errors; + root /srv/servnest/core/http-errors; try_files /418.html =500; } # 500 Internal Server Error error_page 500 @500; location @500 { - root /srv/servnest/errors; - try_files /500.html =500; + root /srv/servnest/core/http-errors; + try_files /500.php /500.en.html =500; + index /500.php; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass unix:/run/php-fpm/servnest.sock; + include inc/fastcgi.conf; + fastcgi_index /500.php; } # 502 Bad Gateway error_page 502 @502; location @502 { - root /srv/servnest/errors; + root /srv/servnest/core/http-errors; try_files /502.html =500; } # 503 Service Unavailable error_page 503 @503; location @503 { - root /srv/servnest/errors; - try_files /503.html =500; + root /srv/servnest/core/http-errors; + try_files /503.php =500; + index /503.php; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass unix:/run/php-fpm/servnest.sock; + include inc/fastcgi.conf; + fastcgi_index /503.php; } # 504 Gateway Timeout error_page 504 @504; location @504 { - root /srv/servnest/errors; + root /srv/servnest/core/http-errors; try_files /504.html =500; } diff --git a/install/nginx/sites/default-server.conf b/install/nginx/sites/default-server.conf index a4bd0c3..769b8a4 100644 --- a/install/nginx/sites/default-server.conf +++ b/install/nginx/sites/default-server.conf @@ -9,12 +9,8 @@ server { ssl_stapling off; - root /srv/servnest/errors; - try_files index.php index.html $uri $uri/; - index index.php index.html; - location / { - root /srv/servnest/errors; + root /srv/servnest/core/http-errors; try_files /index.php =500; index index.php; fastcgi_split_path_info ^(.+\.php)(/.+)$; diff --git a/install/nginx/sites/http.conf b/install/nginx/sites/http.conf index 08ee57b..6b2a58f 100644 --- a/install/nginx/sites/http.conf +++ b/install/nginx/sites/http.conf @@ -11,9 +11,9 @@ server { # Display an explanation page error_page 403 @http403; location @http403 { - root /srv/servnest/errors; - try_files /http.php =500; - index http.php; + root /srv/servnest/core/http-errors; + try_files /unsecure.php =500; + index unsecure.php; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/run/php-fpm/servnest.sock; include inc/fastcgi.conf; diff --git a/srv/servnest/errors/400.html b/srv/servnest/errors/400.html deleted file mode 100644 index 6330cbe..0000000 --- a/srv/servnest/errors/400.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - Bad request · HTTP 400 - - -

Bad request

-

- The request is malformed. -

- HTTP 400 - - diff --git a/srv/servnest/errors/403.html b/srv/servnest/errors/403.html deleted file mode 100644 index 1c2fa6e..0000000 --- a/srv/servnest/errors/403.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - Access forbidden · HTTP 403 - - -

Access forbidden

-

- The server refused to process the request for security reasons. -

- HTTP 403 - - diff --git a/srv/servnest/errors/404.en.html b/srv/servnest/errors/404.en.html deleted file mode 100644 index d09c1d5..0000000 --- a/srv/servnest/errors/404.en.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - File not found · HTTP 404 - - -

File not found

-

- The server did not find anything at the requested address. -

- - HTTP 404 - - diff --git a/srv/servnest/errors/404.fr.html b/srv/servnest/errors/404.fr.html deleted file mode 100644 index b9748e7..0000000 --- a/srv/servnest/errors/404.fr.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - Fichier introuvable · HTTP 404 - - -

Fichier introuvable

-

- Le serveur n'a rien trouvé à l'adresse demandée. -

- - HTTP 404 - - diff --git a/srv/servnest/errors/404.php b/srv/servnest/errors/404.php deleted file mode 100644 index e58f81c..0000000 --- a/srv/servnest/errors/404.php +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - Method Not Allowed · HTTP 405 - - -

Method Not Allowed

-

- The request method is not supported for this resource. -

- HTTP 405 - - diff --git a/srv/servnest/errors/410.html b/srv/servnest/errors/410.html deleted file mode 100644 index 7b44cd6..0000000 --- a/srv/servnest/errors/410.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - Gone · HTTP 410 - - -

Gone

-

- The requested resource is not available anymore. -

- HTTP 410 - - diff --git a/srv/servnest/errors/418.html b/srv/servnest/errors/418.html deleted file mode 100644 index fcf0bf9..0000000 --- a/srv/servnest/errors/418.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - I'm a teapot · HTTP 418 - - -

I'm a teapot

-

- Your coffee cannot be brewed because this server is a teapot. -

- HTTP 418 - - diff --git a/srv/servnest/errors/500.html b/srv/servnest/errors/500.html deleted file mode 100644 index 88a41d5..0000000 --- a/srv/servnest/errors/500.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - Server error · HTTP 500 - - -

Server error

-

- The server encountered an error and is unable to satisfy your request. -

- - HTTP 500 - - diff --git a/srv/servnest/errors/502.html b/srv/servnest/errors/502.html deleted file mode 100644 index 7e55459..0000000 --- a/srv/servnest/errors/502.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - Bad gateway · HTTP 502 - - -

Bad gateway

-

- The backend server encountered an error and is unable to satisfy your request. -

- - HTTP 502 - - diff --git a/srv/servnest/errors/503.html b/srv/servnest/errors/503.html deleted file mode 100644 index 7e84963..0000000 --- a/srv/servnest/errors/503.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - Service unavailable · HTTP 503 - - -

Service unavailable

-

- The server cannot handle the request, because it is overloaded or down for maintenance. -

- - HTTP 503 - - diff --git a/srv/servnest/errors/504.html b/srv/servnest/errors/504.html deleted file mode 100644 index 3a3b928..0000000 --- a/srv/servnest/errors/504.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - Gateway timeout · HTTP 504 - - -

Gateway timeout

-

- The backend server did not send a timely response. -

- - HTTP 504 - - diff --git a/srv/servnest/errors/default-domain.en.html b/srv/servnest/errors/default-domain.en.html deleted file mode 100644 index c1d3c69..0000000 --- a/srv/servnest/errors/default-domain.en.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - Broken site - - -

Broken site

-

- The site you're trying to reach is misconfigured. This domain seems to be pointing to this server, but this server is not aware of a site using this domain. -

- HTTP 404 - - diff --git a/srv/servnest/errors/default-ip.en.html b/srv/servnest/errors/default-ip.en.html deleted file mode 100644 index bb17fe4..0000000 --- a/srv/servnest/errors/default-ip.en.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - Nothing here - - -

Nothing here

-

- You reached the default site of this server using IP address. There's nothing for you here. -

- HTTP 404 - - diff --git a/srv/servnest/errors/http.php b/srv/servnest/errors/http.php deleted file mode 100644 index 264a911..0000000 --- a/srv/servnest/errors/http.php +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - TLS required - - -

TLS required

-

- This site does not accept HTTP requests without TLS. -

-

What happened?

-

- You made a request using HTTP without TLS to the server, which refused this for privacy and security reasons, as unsecure HTTP connections can be watched and modified by any device on the way. -

-

How to solve this?

-

- You can replace the URI scheme http by https to tell your client to make the request using TLS. -

- HTTP 403 - - diff --git a/srv/servnest/errors/unsecure.fr.php b/srv/servnest/errors/unsecure.fr.php deleted file mode 100644 index 655cb2b..0000000 --- a/srv/servnest/errors/unsecure.fr.php +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - Nécessite TLS - - -

Nécessite TLS

-

- Ce site n'accepte pas les connexions HTTP sans TLS. -

-

Que s'est-il passé ?

-

- Vous avez envoyé une requête HTTP sans TLS au serveur, qui l'a refusée pour des raisons de sécurité et de confidentialité. -

-

Comment régler ce problème ?

-

- Vous pouvez remplacer le schéma d'URI http par https pour indiquer à votre client de faire la requête avec TLS. -

- HTTP 403 - -