HOWTO - "We're currently unavailable, please return later" - my way

Discussion in 'Tips/Tricks/Mods' started by necromncr, May 27, 2009.

  1. necromncr

    necromncr New Member

    Hi,

    Here I am writing again and to be completely honest with you - it's in a selfish way. I'm writing this because I need this feature once again in 2 weeks and forgot to make a backup of my old files. So here goes!

    This will show your visitors a friendly message that entire hosting operation has been 'shut down' during maint. period (while you copy all your data to a new server, perhaps?).

    What I did was:
    1.) created new /var/www2 folder
    2.) installed lighttpd and made the following modifications to it:
    a) changed it's document-root to folder made in step 1
    b) added redirect to match any request
    3.) shutdown apache and started lighttp
    4.) tested the whole thing (you dont want to be mocked by your customers and your competition!) ;-)

    This HOWTO is written for Debian and ISPConfig 2.x but it's easly adaptible to anything that runs Linux.

    0.) You'll need a notice.html file with some sort of notice for your customers. You can easily change the name to anything you like, even use php file. See below.

    1.) Create new folder for lighttpd:
    Code:
    mkdir /var/www2
    2.) Install lighttpd and modify it:
    Code:
    apt-get install lighttpd
    Modify document-root. Open /etc/lighttpd/lighttpd.conf and modify this line:
    Code:
    server.document-root       = "/var/www/"
    into this:
    Code:
    server.document-root       = "/var/www2/"
    Add redirect code:
    Code:
    $HTTP["url"] !~ "^/notice.html|/notice.png$" {
            url.redirect = (
                    ".*" => "http://www.example.net/notice.html"
            )
    }
    This checks if request comes in that's not our system not available notice and redirects to your web server.
    Be sure to match the urls (notice.html) otherwise you'll get an endless loop!

    3.) Stop your apache and start lighttpd. If you're upgrading / moving your sistem it might be a good idea to stop ISPConfig too or at least block it.

    4.) Go and check one of your customer domains. It should show your system notice on your www.example.net/notice.html page.

    Hope this will be helpful for any of you and good luck upgrading / moving your ISPConfig!
     
    Last edited: Oct 7, 2009

Share This Page