I want to write about a little trick with SSI, which recently came in handy for me.
Suppose you need to roll out a slightly modified version of a certain page at exactly midnight, or at any other very inconvenient time, when all normal people are sleeping for a long time. Also, suppose you do not want to mess around with crown, and in general, you have tested everything a thousand times, so nothing can happen. :)
For this purpose, we can use nginx-sovy SSI. You will not have to make any changes to the nginx config, and the page itself may look something like this: ')
<!--# config timefmt="%d%m%Y" --> <!-- , $date_local --> <!--# if expr="$date_local = 01012010" --> <!--# include virtual="/path/to/new_year_congratulations/" stub="Oops!" --> <!--# else --> <!--# include virtual="/path/to/usual/version/of/block/" stub="Oops2!" --> <!--# endif--> <!-- $date_local $date_gmt - , , -->
And now, exactly at midnight, January 1, 2010, your users will see a happy new year greetings on the site of some ordinary block. Moreover, at this time you can sleep peacefully (or, get drunk with friends). :) Moreover, exactly at midnight, the second of January, the greeting will disappear without your participation.
This method, of course, can be expanded and improved, achieving the most unusual results. For example, it is possible, automatically, every Friday, to congratulate users on the end of the work week.
Naturally, he has drawbacks: - your if will be executed with each page return - it can be critical on servers with a very slow processor, or on a VPS; - some periods of time in such a way to determine all the same will not work, or it will require more than one operator “if”; - something else… :)
But, in general - a good, convenient, and most importantly, quick solution.