# Modern way to distinguish executable files?

**URL:** <https://www.ruby-forum.com/t/modern-way-to-distinguish-executable-files/200235>\
**Category:** NGINX\
**Created:** [December 7, 2010, 4:11pm UTC](https://www.ruby-forum.com/t/modern-way-to-distinguish-executable-files/200235 "2010-12-07T16:11:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Post date:** [December 7, 2010, 4:11pm UTC](https://www.ruby-forum.com/t/modern-way-to-distinguish-executable-files/200235/1 "2010-12-07T16:11:06Z")

</div>

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 N.
