Alias which works like in other web servers

Jean-Philippe skateinmars at skateinmars.net
Sun Aug 5 03:25:09 MSD 2007


Hello,
Personally, I use this :

 location ~ \.php$
    {
      include /usr/local/nginx/conf/fastcgi.conf;
      fastcgi_pass   127.0.0.1:9000;
      fastcgi_index  gabarit.php;
      fastcgi_param  SCRIPT_FILENAME /path/to/scripts$fastcgi_script_name;
      fastcgi_param  REQUEST_URI      $request_uri;
      fastcgi_param  QUERY_STRING     $query_string;
      fastcgi_param  REQUEST_METHOD   $request_method;
      fastcgi_param  CONTENT_TYPE     $content_type;
      fastcgi_param  CONTENT_LENGTH   $content_length;
    }

So non php files aren't passed to fcgi.

Ezra Zygmuntowicz a écrit :
> 
> 
> On Aug 4, 2007, at 2:04 PM, marc at corky.net wrote:
> 
>> I already had this working like this.   But unfortunately every single
>> request, for any file (jpg, swf...etc) gets passed to fastcgi, too...
>>
>>
> 
> 
> Try adding this conditional to each location block *above* the
> fastcgipass stuff:
> 
>    location / {
>        root   /var/www/site;
> 
>        if (-f $request_filename) {
>          break;
>        }
> 
>        fastcgi_pass    ...
>        fastcgi_index   index.php;
>        fastcgi_param   SCRIPT_NAME      $document_root$fastcgi_script_name;
>        ...
>    }
> 
> 
> Cheers-
> 
> -- Ezra Zygmuntowicz-- Founder & Ruby Hacker
> -- ez at engineyard.com
> -- Engine Yard, Serious Rails Hosting
> -- (866) 518-YARD (9273)
> 
> 
> 





More information about the nginx mailing list