Maintenance works without drama: how to inform visitors when the server has been shut down

Sometimes you need to shut some web-services down for a while to do some maintenance works. Of course, you have warned all users about the scheduled downtime period, but what if it’s just impossible to inform all potential victims, e.g. every potential visitor of some web-site that won’t be working? It’s a good idea to take care of those people (or bots) and to let them know what’s going on and when their websites is up. It’s easy to make a web-server showing some maintenance notice, but what if you need to shut the server down completely? If it’s a single server, not a cluster, what visitors will see when you shut it down? They will wait for the page to be loaded, but a message saying that the connection is timed out will be the only reward for their patience. It would be much better to let them know that you’re apologizing for inconveniences, working hard to fix the issue and have some prognosis on when it’ll be okay.

So, let’s involve some spare web-server (supposedly, you have some, don’t you?) and make it showing some calming message for users and visitors of their web-sites. It’s quite easy when you have a spare web-server connected to the same network or vlan, there are just few simple steps that needed to be performed.

Step 1: creating the announcement page

Maybe one of your colleagues has already wrote an announcement and published it where your users can read it, didn’t they? If yes – let’s take the text for the notice from there, if not – let’s write the message by ourselves. Of course, as we need it to be formatted properly, we should add some HTML-tags.

Lots of thanks to Pitch for the sample!)

Now let’s put this page somewhere, for example to /var/www/vhosts/

Step 2: configuring nginx

No, I won’t believe you don’t know how to install nginx on your operating system. So let’s suppose you’ve done it already and we only need to add the following server stanza to its configuration:

Step 3: interception

If the spare server is in the same IP-network with our, it’s easy to make it receive all requests intended for, just add an according alias to the network interface, for example:

Well, that’s all! Just don’t forget to update the information on the maintenance page when you realize you won’t bring the service up in time you’ve promised! 🙂

One thought on “Maintenance works without drama: how to inform visitors when the server has been shut down

  1. Just a cheat-sheet for Apache HTTPd 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.