# Try\_files on windows

**URL:** <https://www.ruby-forum.com/t/try-files-on-windows/205478>\
**Category:** NGINX\
**Created:** [April 7, 2011, 10:44am UTC](https://www.ruby-forum.com/t/try-files-on-windows/205478 "2011-04-07T10:44:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [April 7, 2011, 10:44am UTC](https://www.ruby-forum.com/t/try-files-on-windows/205478/1 "2011-04-07T10:44:18Z")

</div>

We use nginx in production (linux) and as development machines on  
windows.  
The following is on Windows (I didn’t test on linux),  
case 1: try\_files $uri $uri/index.php; → works fine  
and shows the page index.php  
case 2: try\_files $uri $uri/index.php $bootstrap; → shows the  
$bootstrap page even if $uri/index.php exists  
case 3: try\_files $uri $bootstrap; → works  
fine and shows $bootstrap as it should

I can’t get it to work in case 2. I also tried index index.php; but it  
still doesn’t work  
It seems like a pretty basic requirement and I don’t understand why it  
wouldn’t work fairly simply. Has anyone else encountered this problem  
and enlighten me whether it’s a bug or am I doing something wrong?

In case someone wishes to see the full setup, here it is

server {  
listen 80;  
server\_name ~^.+alpha.+$ ;

set $server d:/BeoAppSrv ;  
set $bootstrap /public/alpha/bootstrap.php ;

root $server$myroot ;

access\_log ./…/…/var/log/nginx/http-alpha.log debug0 ;  
index index.php;# index.html index.htm index.php ;

if ($host ~\*  
“^([^.]+(.[^.]+)_).alpha.local.((._).(com|net|org)(..\*)?)$”) {  
set $dom $3;  
set $sub $1;  
}

if ($host ~\* “^alpha.local.(([^.]+).((com|net|org)(..\*)?$))”) {  
set $dom $1;  
set $sub www;  
}

```
    set $myroot /public/alpha/sites/$dom/$sub/htdocs ;

    location ~

```

.(jpg|jpeg|png|gif|swf|flv|mp4|mov|avi|wmv|m4v|mkv|ico|js|css|xml|xslt)$  
{  
gzip on;  
gzip\_comp\_level 2;  
gzip\_vary on;  
gzip\_proxied any;  
gzip\_types text/plain text/xml text/css application/x-javascript;  
expires 365d;  
}

location ^~ /ui/ { alias ./…/…/public/ui/; }

try\_files $uri $uri/index.php $bootstrap?$uri&$args;

location ~ .php$ {  
fastcgi\_pass 127.0.0.1:9010;  
fastcgi\_index index.php;  
fastcgi\_param SCRIPT\_FILENAME  
$server$myroot$fastcgi\_script\_name;  
include fastcgi\_params;  
}  
}

Posted at Nginx Forum:

> **[try\_files on windows](https://forum.nginx.org/read.php?2,189048,189048#msg-189048)**
>
> We use nginx in production (linux) and as development machines on windows. The following is on Windows (I didn't test on linux), case 1: try\_files $uri $uri/index.php; -\> works fine and shows the page index.php case 2: try\_files $uri...
