Welcome! Log In Create A New Profile

Advanced

Switches in configuration files?

Rt Ibmer
June 17, 2009 04:05PM
Is there a way to create a variable in the config file that I can set to true or false (or 1 or 2, etc) and then make my location blocks do an IF operation based on that var to take different actions in the block.

For instance this is what I currently have:

location ~* /maindir/area1 {
error_page 500 502 503 504 /service-is-down.html;

access_log /main.log main;
proxy_pass http://my_farm;

# To temporarily take service offline, comment out the 2 lines above, and remove the comments from below.
# The incoming requests will then be logged for manual later handling.
# access_log /deferred.log main;
# empty_gif;
# expires -1d;
}

And instead I'd rather have something like this:

location ~* /maindir/area1 {
error_page 500 502 503 504 /service-is-down.html;

if(inMaintenanceMode == true) {
access_log /main.log main;
proxy_pass http://my_farm;
}
else
{
access_log /deferred.log main;
empty_gif;
expires -1d;
}
}

Can this sort of thing be done and if so can someone please demonstrate with a tiny snippet? Thanks!
Subject Author Posted

Switches in configuration files?

Rt Ibmer June 17, 2009 04:05PM

Re: Switches in configuration files?

Rt Ibmer June 18, 2009 12:22PM

Re: Switches in configuration files?

edogawaconan June 18, 2009 12:35PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 163
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready