add custom 502 error page

This commit is contained in:
2026-01-20 17:13:19 +01:00
parent 885bfe08eb
commit 83d6fe194b
5 changed files with 93 additions and 9 deletions

View File

@@ -22,8 +22,7 @@ packages:
- git
- nfs-common
- curl
- python3-flask
- gunicorn
- nginx
write_files:
- path: /opt/environment/.env
@@ -38,9 +37,18 @@ write_files:
permissions: "0755"
content: |
${traefik-service}
- path: /usr/share/nginx/error-pages/502.html
permissions: "0644"
content: |
{nginx-error-502}
- path: /etc/nginx/sites-available/default
permissions: "0644"
content: |
{nginx-error-configuration}
runcmd:
- /opt/gateway/install-traefik.sh
- ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled
- systemctl start nginx.service
final_message: |
Base system ready for ${hostname}

View File

@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=500, initial-scale=1.0">
<title>Service unavailable</title>
<style>
body {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 70vh;
background-color: rgba(248, 241, 219, 0.801);
}
.box {
display: flex;
flex-direction: column;
align-items: center;
box-shadow: rgba(76, 76, 80, 0.2) 0px 7px 29px 0px;
width: 30vw;
padding: 2rem;
background-color: rgb(255, 255, 255);
}
</style>
</head>
<body>
<div class="box">
<h1>Le service n'est pas disponible.</h1>
<p>
Il est possible que le serveur soit éteint pour les raisons suivantes :
<ul>
<li>Maintenance hebdomadaire (mise à jour des services ou sauvegarde).</li>
<li>Le service n'est plus maintenu.</li>
</ul>
</p>
<aside>
Contactez l'administrateur ou patientiez quelques instant.
</aside>
</div>
</body>
</html>

View File

@@ -0,0 +1,10 @@
server {
listen 8090;
server_name localhost;
error_page 502 /502.html;
location / {
root /usr/share/nginx/error-pages;
}
}

View File

@@ -25,7 +25,8 @@ module "vm" {
proxmox_host_ip = var.proxmox_host_ip
traefik-service = indent(6, file("${path.module}/lib/services/traefik.service"))
install-traefik-script = indent(6, file("${path.module}/lib/scripts/install-traefik.sh"))
nginx-error-configuration = indent(6, file("${path.module}/lib/scripts/default"))
nginx-error-502 = indent(6, file("${path.module}/lib/scripts/502.html"))
env-file-content = indent(6, file("${path.module}/.env"))
}
)