try_files ignored in combination with error_page and named locations

Edho Arief edho at myconan.net
Wed Apr 4 09:03:30 UTC 2012


2012/4/4 Džen <yvldwt at gmail.com>:
> Thank you very much for your clarifying explanation. Seems like the only
> thing missing was "recursive_error_pages on" for it to work like I
> wanted it to have.
>
> On 04/04/12 12:16pm, Ruslan Ermilov wrote:
>> [...]
>>
>> First, this is a wacky config, and I don't quite understand what
>> you're trying to achieve with it.  :)
>
> Just to make you understand what I was trying to achieve with this
> config: my maintenance page contains img tags pointing to images located
> in $document_root. I used to add a simple
>
>        try_files /$hostid-maintenance/ @backend;
>
> to my configuration, but as expected a request to /foo.png returns the
> contents of /$hostid-maintenance/index.html instead. Thus I was looking
> for a solution to use a whole directory as an error page (being able to
> request other files which are located inside the maintenance
> $document_root).
>

location /maintenance-static/ {

}

location / {
  try_files /$hostid-maintenance/ @backend;
}



More information about the nginx mailing list