if ,-f and variables

Igor Sysoev is at rambler-co.ru
Wed Feb 27 19:41:58 MSK 2008


On Wed, Feb 27, 2008 at 11:26:56AM -0500, Sean Allen wrote:

> this works:
> 
> if ( -f /ah/sites/colon365.co.uk/public/.maintenance )
> {
>   set $maintenance 1;
> }
> 
> this doesn't:
> 
> if ( -f $document_root/.maintenance )
> {
>   set $maintenance 1;
> }
> 
> two questions,
> 
> 1. is there a way to make the latter work? some slight change or tweak?
> 2. why doesn't it work? are variables not interpolated when doing file  
> system checks like -f?

Have you defined root ?

      root /ah/sites/colon365.co.uk/public;

      if (-f $document_root/.maintenance) {
          set $maintenance 1;
      }


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list