try_files and GET variables

Reinis Rozitis r at roze.lv
Mon Mar 30 17:47:21 MSD 2009


Hello,
tried to replace the webserver config to use try_files instead of rewrites (on 0.7.46), it kinda works but I get some garbage in 
QUERY_STRING on the php fastcgi backend - so php doesnt see any GET variable.


The config is simple:

location /tmp {
    try_files $uri /index.php;
}


When I open http://myserver/tmp/?var=1  and dump the $_SERVER variables 'REQUEST_URI' is correct -  '/tmp/?var=1' but QUERY_STRING 
gets something like 'H‰H=�' (non-printable chars)




If I change the nginx config to named location everything works as expected (all the GET variables are passed and QUERY_STRING is 
correct):

location /tmp {
    try_files $uri @tmp;
}

location @tmp{
              fastcgi_pass   127.0.0.1:1026;
              fastcgi_index  index.php;
             include        fastcgi_params;
             fastcgi_param  SCRIPT_FILENAME  $document_root/index.php;
 }


Where is the catch?


wbr
Reinis Rozitis 






More information about the nginx mailing list