try_files on windows nginx-forum at
Thu Apr 7 12:43:33 MSD 2011

We use nginx in production (linux) and as development machines on
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 ~
		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_index  index.php;
     fastcgi_param  SCRIPT_FILENAME 
     include        fastcgi_params;

Posted at Nginx Forum:,189048,189048#msg-189048

More information about the nginx mailing list