Browse Source

[Nginx] Custom 502

andryyy 6 years ago
parent
commit
9b7668d912
2 changed files with 22 additions and 0 deletions
  1. 5 0
      data/conf/nginx/site.conf
  2. 17 0
      data/web/_status.502.html

+ 5 - 0
data/conf/nginx/site.conf

@@ -210,4 +210,9 @@ server {
   }
 
   include /etc/nginx/conf.d/site.*.custom;
+
+  error_page 502 @awaitingupstream;
+  location @awaitingupstream {
+    rewrite ^(.*)$ /_status.502.html break;
+  }
 }

+ 17 - 0
data/web/_status.502.html

@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Missing upstream</title>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
+  </head>
+  <body style='color:grey;text-align:center;font-family: Verdana, "Lucida Sans Unicode", sans-serif'>
+    <p>Oops, <b>502</b> - we are probably preparing mailcow.</p>
+    <h1 style="color:#999;font-size:48px">502</h1>
+    <p>Please do not stop the stack, while we are preparing the database or do other preparations.</p>
+    <p style="font-size:small"><b>What is happening?</b> - Nginx cannot connect to an upstream server.<br>
+    This is fine, if mailcow was just
+    installed or updated and can take a few minutes.<br>
+    Please check the logs or contact support, if the error persists.</p>
+  </body>
+</html>