try_files on windows

vladanpopovic@be-o.com nginx-forum at nginx.us
Thu Apr 7 12:43:33 MSD 2011


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: http://forum.nginx.org/read.php?2,189048,189048#msg-189048




More information about the nginx mailing list