Modern way to distinguish executable files?
Grzegorz Nosek
grzegorz.nosek at gmail.com
Tue Dec 7 18:09:12 MSK 2010
Hi,
In ye olde nginx 0.5 I used the following to direct requests for
executable files to fcgiwrap (for CGI support):
location / {
root /some/where;
# fastcgi setup
if (-x $request_filename) {
fastcgi_pass unix:/tmp/fcgiwrap.sock;
}
}
What is the modern-day equivalent of this config (try_files and stuff)?
I know I'll have to keep the if(-x) somewhere but I'm looking for a
clean way to wrap it. I'd expect something like this but can't remember
how to unconditionally direct requests to a named location:
location @upstream {
# fastcgi setup
fastcgi_pass unix:/tmp/fcgiwrap.sock;
}
location / {
root /some/where;
if (-x $request_filename) {
# almost hurts to type this ;)
try_files /nonexistent @upstream;
}
}
All suggestions appreciated.
On a semi-related note, is the try_files config inherited in nested
locations? i.e. will the following pass requests for /sub/uri to @upstream?
location / {
location /sub {
auth_basic "Hands off!";
auth_basic_user_file /a/good/place;
}
try_files $uri $uri/ @upstream;
}
Best regards,
Grzegorz Nosek
More information about the nginx
mailing list