Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do big sites do a maintenance notice page?

I am about to upgrade my whole site. I am looking for advices on how tech startups do their maintenance process.

I am thinking of using htaccess. However that only redirect users accessing for example, index.php to maintenance.php right? If user access dashboard.php, there will be no redirection.

During the maintenance, i do need to access index.php (ONLY ME). Anyone who worked in tech startups care to share their solution? Appreciated it alot.

like image 408
Slay Avatar asked May 16 '12 16:05

Slay


People also ask

How do you announce website maintenance?

Please be advised that there will be scheduled downtime across our network from (date/time) to (date/time). This is because we are performing work on (functions/parts of the network). We apologize for any inconvenience. For more information, or if you have any questions, please contact the IT Team at (contact details).

How do I show maintenance page during deployment?

An idea would be: to create another app on the same web server. create httpmodule or httphandler to handle any url request and 302 redirect them to the maintenance page.

What happens when a site is under maintenance?

What is a maintenance page? A maintenance page is a temporary placeholder for times when a site or app needs to be taken offline for updates, backups or maintenance. It tells the visitor that the site they're trying to reach is temporarily unavailable because the team behind the scenes is doing some work.


2 Answers

We are using LightTPD as web server and i am using "mod_magnet" to do such things. Mod_magnet allows me to do request handling using simple lua scripts. We have an automatic task, which will create an empty file somewhere in the web-server's filesystem. The lua script will check for existance of this file on every request and return a static maintenance page, if the file is found. The important part of the script looks like the following:

--
-- maintenance page
--
local config = {
    ['maintenance'] = {
        ['allow'] = {
            '127.0.0.1'    -- just an example IP address
        }
    }
}

if lighty.stat(lighty.env['physical.doc-root'] .. 'maintenance') then
    tmp, _ = table.search(config.maintenance.allow, lighty.env['request.remote-ip'])
    if not tmp then
        -- maintenance modus
        lighty.content = {
            { filename = lighty.env['physical.doc-root'] .. 'error/maintenance.html' }
        }

        return 503
    end
end

In the script there's also a configuration to still let specific IP addresses through, so you can still view the website for example from your company network, when everyone else just get's the maintenance page.

This solution works very well and because of automation, it does not matter, if you need the maintenance page on one or on many webservers.

If you are interested, you can find more information regarding "mod_magnet" over here:

http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ModMagnet

like image 71
aurora Avatar answered Oct 11 '22 22:10

aurora


Since you mention .htaccess I'm assuming you're using Apache as your web server. As other have mentioned you can use .htaccess or you can edit the VirtualHost conf for that specific site.

Either way I would recommend using mod_rewrite as Jonathon Sampson recommended, however, you want to be very careful to make sure that you send the proper status codes as well because important bots such as GoogleBot want to see a 503 which tells them that you are currently in maintenance.

There are some pretty clear instructions for doing exactly what you want in this AskApache article.

like image 37
J Cobb Avatar answered Oct 11 '22 23:10

J Cobb