Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elegant way to make site temporarily unavailable?

Do You know elegant way to make site temporarily unavailable? Any configuration or settings for this?

like image 593
Roman Bats Avatar asked May 19 '12 12:05

Roman Bats


1 Answers

In IIS you can put a app_offline.htm

http://weblogs.asp.net/scottgu/archive/2005/10/06/426755.aspx

In others web servers check the manual or use a script to rename the index to a backup name and then rename the offline page to index and vice versa...

You could also create an 'inactive' file, the 'inactive' file will be checked for existence when pages are loading. If the content is found then you can abort logic.

E.g. in php you would include the following line (via an include inter alia)

<?php if(file_exists('/path/to/OffLine.file')) die('The Application is currently Offline! Please try again in a few minutes...'); ?>

If you wanted this @ the box level you would add the function to the PHP.ini... see http://uk.php.net/manual/en/ini.core.php#ini.auto-prepend-file

To set a PHP.ini per site see https://serverfault.com/questions/34078/how-do-i-set-up-per-site-php-ini-files-on-a-lamp-server-using-namevirtualhosts

The same is obviously possible in other languages.

I have a particular script which does some patching and actually creates this file for me... see Custom app_offline.htm file during publish

like image 94
Jay Avatar answered Sep 29 '22 12:09

Jay