how can i quickly handle alternate config for site downtime?

Igor Sysoev is at rambler-co.ru
Thu Jan 15 17:00:51 MSK 2009


On Wed, Jan 07, 2009 at 06:41:54PM +0100, Igor Clark wrote:

> Merlin wrote:
> 
> > Yes, it sets up a location that you are most likely never going to use.
> > It appears to be convention within nginx configurations.  I don't know
> > when it started, but I've seen it on this list for some time now.  I am
> > pretty sure that you could use other special characters if you wanted,
> > too, it's just a character to nginx.
> 
> Igor S refers to these as "named locations". A common use is e.g.
> 
>     location / {
>         error_page 404 = @myapp;
>     }
> 
>     location @myapp {
>         fastcgi_index blah;
>         fastcgi_param ...;
>     }
> 
> so that any URLs that would normally go through rewrite stages like
> 
>     if (! -e $uri) {
>         rewrite ....;
>     }
> 
> are automatically routed to the appropriate back-end.
> 
> In release 0.7.27 Igor S added the try_files directive which works 
> similarly but adds a list of filesystem locations to try before hitting 
> a named location as default, and only logs errors in case of total 
> failure (as I understand it):
> 
>         location / {
>                 try_files $uri $uri/index.html @myapp;
>         }
> 

The errors will not be logged at all. On total failure nginx will do
internal redirect to last parameter (@myapp in this case).

> I haven't seen any characters other than @ used to notate named 
> locations, but I'm sure Igor S will be able to elucidate.

The "@" is speacial symbol to indicate "named location".
The "named locations" are used in error_page redirection to preserve URI.


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





More information about the nginx mailing list