ForceType directive in nginx fastcgi?

Paul plin at lexico.com
Thu Feb 22 19:22:25 MSK 2007


I'm wondering how to make certain files with no file extensions execute as PHP
files. 

In Apache, this is what I use:

<Location /search>
ForceType application/x-httpd-php
</Location>

In Lighttpd, this is what I use:

fastcgi.map-extensions = ( "/search" => ".php" )
fastcgi.server             = ( ".php" =>
                               ( "localhost" =>
                                 (
                                   "socket" => "/tmp/php-fastcgi.socket",
...

I'm trying not to use rewrites because URLs like http://host/search/a&b becomes
http://host/search.php?a&b with:

location ~ ^/search {
           root /root/path;
           rewrite ^/search?(.*)$  /search.php?$1 break;
       }

Using
location /search/ {
           fastcgi_pass   127.0.0.1:9000;
           fastcgi_param  SCRIPT_FILENAME /root/path/search.php;
           include        fastcgi_params;
        }

drops the input parameter. I'm thinking I need to alter
fastcgi_param  QUERY_STRING       $query_string;
?









More information about the nginx mailing list