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. + +``` + + +
+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