From c5ead611f17d641da70dd8603556098861f23454 Mon Sep 17 00:00:00 2001 From: cube Date: Fri, 29 May 2026 13:31:34 +0000 Subject: [PATCH] Add Custom error page with nginx --- Custom-error-page-with-nginx.md | 51 +++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Custom-error-page-with-nginx.md diff --git a/Custom-error-page-with-nginx.md b/Custom-error-page-with-nginx.md new file mode 100644 index 0000000..821da3e --- /dev/null +++ b/Custom-error-page-with-nginx.md @@ -0,0 +1,51 @@ +Sometimes you need to stop Myriad in order to pull updates, add admin account, or other tasks. In this case, nginx will display a generic 502 (bad gateway) page when anyone tries to access the site. This is okay, but unfamiliar users may not be aware that the site will be back online. Maybe you want to display a page with your own message instead, reassuring any viewers that the service will be back online soon, check back later. + +If that's the case, here's how. + +First of all, make a HTML page containing whatever you want to display. Here's an example. + +``` + + + + Myriad is offline + + + + +

Myriad is offline

+

Looks like Myriad isn't online right now, but it should be back up and running soon!

+

Come back later!

+ + + +``` + +Now paste this into the following location on the server: + +``` +sudo mkdir /var/www/errors +sudo nano /var/www/errors/502.html +``` + +Now edit the site's nginx config: + +``` +sudo nano /etc/nginx/sites-available/default +``` + +Add in the following section after `location / { ... }` + +``` +location /502.html{ + root /var/www/errors; + } +``` + +Finally, reload nginx. + +``` +sudo nginx -s reload +``` + +Feel free to stop Myriad (waitress) from running and head over to your browser to check out your error page. \ No newline at end of file