Hello.
According to english wiki, named locations may be used for other
purposes than fallback :
http://wiki.nginx.org/NginxHttpCoreModule#Named_Locations
However when i tried “try_files @tier_ssi @tier_php” i observed the
following behavior in error_log debug:
2009/12/05 18:53:30 [debug] 19908#0: *399 try to use file: “@tier_ssi”
“/usr/local/nginx/[email protected]_ssi”
2009/12/05 18:53:30 [debug] 19908#0: *399 try to use file: “@tier_php”
“/usr/local/nginx/[email protected]_php”
2009/12/05 18:53:30 [debug] 19908#0: *399 test location: “@tier_php”
2009/12/05 18:53:30 [debug] 19908#0: *399 using location: @tier_php “/?”
location @tier_php was tested first even though @tier_php was first in
try_files and location @tier_ssi ws not tested at all.
meanwhile my confiuration defined both location @tier_ssi {} and
location @tier_php {}
This behavior leads me to believe that nginx allows named location
only at the end of try_files, but documentation contradicts it. Which
is correct?
Ideally i would like to be able to do try_files with multiple named
locations first being tier_ssi and second being tier_php fallback. my
tier_ssi try_files is a php fastcgi_pass to a different backend that
returns some content (and appropriate response headers). if tier_ssi
try_files returns with 404 header it would attempt tier_php in
try_files. tier_php on the other hand is proxy pass to a backend
different from fastcgi_pass in tier_ssi.
Please advise.
Thank you.
./nginx -V
nginx version: nginx/0.8.29
configure arguments: --with-debug
btw you can have the same file parsed for SSI and PHP 
neat little trick i realized which was nice, since one of my clients’
sites was designed that way (don’t ask…)
You are correct http://wiki.nginx.org/NginxHttpCoreModule#try_files
If you read try files documentation try_files test for files existance
and if none are found it goes to fallback which can be a named
location. So named locations are only allowed for the fallback as
documented.
Sent from my iPhone
On Sat, Dec 05, 2009 at 07:10:08PM -0500, Oleg Terenchuk wrote:
2009/12/05 18:53:30 [debug] 19908#0: *399 try to use file: “@tier_php”
This behavior leads me to believe that nginx allows named location
only at the end of try_files, but documentation contradicts it. Which
is correct?
Ideally i would like to be able to do try_files with multiple named
locations first being tier_ssi and second being tier_php fallback. my
tier_ssi try_files is a php fastcgi_pass to a different backend that
returns some content (and appropriate response headers). if tier_ssi
try_files returns with 404 header it would attempt tier_php in
try_files. tier_php on the other hand is proxy pass to a backend
different from fastcgi_pass in tier_ssi.
location / {
# tier_ssi
fastcgi stuff
fastcgi_intercept_errors on;
error_page 404 = @tier_php;
}
location @tier_php {
…
}
–
Igor S.
http://sysoev.ru/en/
Sometime after posting to mailing list i came to the same solution.
thank you for confirming correctness :).
On Sun, Dec 6, 2009 at 4:33 AM, Igor S. [email protected] wrote:
2009/12/05 18:53:30 [debug] 19908#0: *399 try to use file: “@tier_ssi”
location @tier_php {}
try_files. tier_php on the other hand is proxy pass to a backend
location @tier_php {
[email protected]
http://nginx.org/mailman/listinfo/nginx
–
Oleg Terenchuk
Phone: 917 - 306 - 5653