Welcome! Log In Create A New Profile

Advanced

Modern way to distinguish executable files?

Grzegorz Nosek
December 07, 2010 10:14AM
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

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Modern way to distinguish executable files?

Grzegorz Nosek December 07, 2010 10:14AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 147
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready