ForceType directive in nginx fastcgi?

Igor Sysoev is at rambler-co.ru
Thu Feb 22 20:37:43 MSK 2007


On Thu, Feb 22, 2007 at 04:22:25PM +0000, Paul wrote:

> 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;
>         }

You should use

   location /search {
           fastcgi_pass   127.0.0.1:9000;
           # fastcgi_pass   /tmp/php-fastcgi.socket;

           fastcgi_param  SCRIPT_FILENAME  /root/path$fastcgi_script_name;
           include        fastcgi_params;
   }

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

fastcgi_param  QUERY_STRING       $query_string;

is already in the fastcgi_params file.


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list