Nginx Problem with fastcgi_param

Igor Sysoev is at
Wed May 14 13:15:21 MSD 2008

On Tue, May 13, 2008 at 04:06:54PM -0700, Erik Osterman wrote:

> We've been running Nginx(0.5.33)+FastCGI(php-cgi 5.1.6) on Fedora 6 for 
> 1 week now and very happy with it. Before this, we were using Nginx as 
> strictly a HTTP load balancer. I have encountered an issue migrating to 
> FastCGI, which is that HTTP_HOST cannot be set using fastcgi_param. It 
> seems that no matter what I pass (e.g., Nginx is not 
> honoring it, passing the real HTTP_HOST of the request instead. The 
> other variables like SCRIPT_FILENAME and SCRIPT_NAME are getting set 
> properly if I change them.
> Is there something I am doing wrong or is this a known issue?

nginx passes HTTP headers to FastCGI as is and does not allow to
override them. Unlike proxied server, FastCGI usually does not depend on
Host header.

> Best,
> Erik
> fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
> fastcgi_param  SERVER_SOFTWARE    nginx;
> fastcgi_param  QUERY_STRING       $query_string;
> fastcgi_param  REQUEST_METHOD     $request_method;
> fastcgi_param  CONTENT_TYPE       $content_type;
> fastcgi_param  CONTENT_LENGTH     $content_length;
> fastcgi_param  SCRIPT_FILENAME    $script_filename;
> fastcgi_param  SCRIPT_NAME        $script_name;
> fastcgi_param  REQUEST_URI        $uri;
> fastcgi_param  DOCUMENT_URI       $document_uri;
> fastcgi_param  DOCUMENT_ROOT      $document_root;
> fastcgi_param  SERVER_PROTOCOL    $server_protocol;
> fastcgi_param  REMOTE_ADDR        $remote_addr;
> fastcgi_param  REMOTE_PORT        $remote_port;
> fastcgi_param  SERVER_ADDR        $server_addr;
> fastcgi_param  SERVER_PORT        $server_port;
> fastcgi_param  SERVER_NAME        $server_name;
> fastcgi_param  HTTP_HOST;                

Igor Sysoev

More information about the nginx mailing list