Move HTTP error pages to the core repository
This commit is contained in:
parent
216f747033
commit
44d62a49b1
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)(/.+)$;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Bad request · HTTP 400</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Bad request</h1>
|
||||
<p>
|
||||
The request is malformed.
|
||||
</p>
|
||||
<small>HTTP <code>400</code></small>
|
||||
</body>
|
||||
</html>
|
|
@ -1,15 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Access forbidden · HTTP 403</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Access forbidden</h1>
|
||||
<p>
|
||||
The server refused to process the request for security reasons.
|
||||
</p>
|
||||
<small>HTTP <code>403</code></small>
|
||||
</body>
|
||||
</html>
|
|
@ -1,19 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>File not found · HTTP 404</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>File not found</h1>
|
||||
<p>
|
||||
The server did not find anything at the requested address.
|
||||
</p>
|
||||
<ul>
|
||||
<li>The file may have been moved or deleted.</li>
|
||||
<li>Perhaps the address was mistyped.</li>
|
||||
</ul>
|
||||
<small>HTTP <code>404</code></small>
|
||||
</body>
|
||||
</html>
|
|
@ -1,19 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Fichier introuvable · HTTP 404</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Fichier introuvable</h1>
|
||||
<p>
|
||||
Le serveur n'a rien trouvé à l'adresse demandée.
|
||||
</p>
|
||||
<ul>
|
||||
<li>Le fichier a pu être déplacé ou supprimé.</li>
|
||||
<li>L'adresse a peut-être été mal saisie.</li>
|
||||
</ul>
|
||||
<small>HTTP <code>404</code></small>
|
||||
</body>
|
||||
</html>
|
|
@ -1,18 +0,0 @@
|
|||
<?php
|
||||
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
||||
$clientLocales = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
|
||||
$clientLocales = preg_replace("#[A-Z0-9]|q=|;|-|\.#", "", $clientLocales);
|
||||
$clientLocales = explode(',', $clientLocales);
|
||||
$availableLocales = array('en', 'fr');
|
||||
foreach ($clientLocales as $clientLocale) {
|
||||
if (in_array($clientLocale, $availableLocales)) {
|
||||
$locale = $clientLocale;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($locale) AND $locale == "fr")
|
||||
echo file_get_contents("404.fr.html");
|
||||
else
|
||||
echo file_get_contents("404.en.html");
|
|
@ -1,15 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Method Not Allowed · HTTP 405</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Method Not Allowed</h1>
|
||||
<p>
|
||||
The request method is not supported for this resource.
|
||||
</p>
|
||||
<small>HTTP <code>405</code></small>
|
||||
</body>
|
||||
</html>
|
|
@ -1,15 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Gone · HTTP 410</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Gone</h1>
|
||||
<p>
|
||||
The requested resource is not available anymore.
|
||||
</p>
|
||||
<small>HTTP <code>410</code></small>
|
||||
</body>
|
||||
</html>
|
|
@ -1,15 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>I'm a teapot · HTTP 418</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>I'm a teapot</h1>
|
||||
<p>
|
||||
Your coffee cannot be brewed because this server is a teapot.
|
||||
</p>
|
||||
<small>HTTP <code>418</code></small>
|
||||
</body>
|
||||
</html>
|
|
@ -1,19 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Server error · HTTP 500</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Server error</h1>
|
||||
<p>
|
||||
The server encountered an error and is unable to satisfy your request.
|
||||
</p>
|
||||
<ul>
|
||||
<li>This error is probably temporary.</li>
|
||||
<li>If it isn't, you can try to contact an administrator.</li>
|
||||
</ul>
|
||||
<small>HTTP <code>500</code></small>
|
||||
</body>
|
||||
</html>
|
|
@ -1,19 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Bad gateway · HTTP 502</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Bad gateway</h1>
|
||||
<p>
|
||||
The backend server encountered an error and is unable to satisfy your request.
|
||||
</p>
|
||||
<ul>
|
||||
<li>This error is probably temporary.</li>
|
||||
<li>If it isn't, you can try to contact an administrator.</li>
|
||||
</ul>
|
||||
<small>HTTP <code>502</code></small>
|
||||
</body>
|
||||
</html>
|
|
@ -1,19 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Service unavailable · HTTP 503</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Service unavailable</h1>
|
||||
<p>
|
||||
The server cannot handle the request, because it is overloaded or down for maintenance.
|
||||
</p>
|
||||
<ul>
|
||||
<li>This error is probably temporary.</li>
|
||||
<li>If it isn't, you can try to contact an administrator.</li>
|
||||
</ul>
|
||||
<small>HTTP <code>503</code></small>
|
||||
</body>
|
||||
</html>
|
|
@ -1,19 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Gateway timeout · HTTP 504</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Gateway timeout</h1>
|
||||
<p>
|
||||
The backend server did not send a timely response.
|
||||
</p>
|
||||
<ul>
|
||||
<li>This error is probably temporary.</li>
|
||||
<li>If it isn't, you can try to contact an administrator.</li>
|
||||
</ul>
|
||||
<small>HTTP <code>504</code></small>
|
||||
</body>
|
||||
</html>
|
|
@ -1,15 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Broken site</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Broken site</h1>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<small>HTTP <code>404</code></small>
|
||||
</body>
|
||||
</html>
|
|
@ -1,15 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Nothing here</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Nothing here</h1>
|
||||
<p>
|
||||
You reached the default site of this server using IP address. There's nothing for you here.
|
||||
</p>
|
||||
<small>HTTP <code>404</code></small>
|
||||
</body>
|
||||
</html>
|
|
@ -1,21 +0,0 @@
|
|||
<?php
|
||||
|
||||
http_response_code(403);
|
||||
|
||||
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
||||
$clientLocales = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
|
||||
$clientLocales = preg_replace("#[A-Z0-9]|q=|;|-|\.#", "", $clientLocales);
|
||||
$clientLocales = explode(',', $clientLocales);
|
||||
$availableLocales = array('en', 'fr');
|
||||
foreach ($clientLocales as $clientLocale) {
|
||||
if (in_array($clientLocale, $availableLocales)) {
|
||||
$locale = $clientLocale;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($locale) AND $locale === "fr")
|
||||
require "unsecure.fr.php";
|
||||
else
|
||||
require "unsecure.en.php";
|
|
@ -1,8 +0,0 @@
|
|||
<?php
|
||||
|
||||
http_response_code(404);
|
||||
|
||||
if (filter_var(str_replace(array('[', ']'), '', $_SERVER['HTTP_HOST']), FILTER_VALIDATE_IP))
|
||||
echo file_get_contents("default-ip.en.html");
|
||||
else
|
||||
echo file_get_contents("default-domain.en.html");
|
|
@ -1,23 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>TLS required</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>TLS required</h1>
|
||||
<p>
|
||||
This site does not accept HTTP requests without TLS.
|
||||
</p>
|
||||
<h2>What happened?</h2>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<h2>How to solve this?</h2>
|
||||
<p>
|
||||
You can replace the URI scheme <code>http</code> by <code>https</code> to tell your client to make the request using TLS.
|
||||
</p>
|
||||
<code>HTTP 403</code>
|
||||
</body>
|
||||
</html>
|
|
@ -1,23 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Nécessite TLS</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Nécessite TLS</h1>
|
||||
<p>
|
||||
Ce site n'accepte pas les connexions HTTP sans TLS.
|
||||
</p>
|
||||
<h2>Que s'est-il passé ?</h2>
|
||||
<p>
|
||||
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é.
|
||||
</p>
|
||||
<h2>Comment régler ce problème ?</h2>
|
||||
<p>
|
||||
Vous pouvez remplacer le schéma d'URI <code>http</code> par <code>https</code> pour indiquer à votre client de faire la requête avec TLS.
|
||||
</p>
|
||||
<code>HTTP 403</code>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue