possible fastcgi_params bug or undocumented feature

Maxim Dounin mdounin at mdounin.ru
Fri Mar 21 03:55:04 MSK 2008


Hello!

On Thu, Mar 20, 2008 at 06:35:33PM -0500, Rob Schultz wrote:

> Hi,
> 	Today i was configuring nginx to "act" more like apache when using https 
> (Apache sets the fastcgi paramater HTTPS to on and this is how phpmyadmin 
> detects if you are using https or not) Well i only wanted this paramater to 
> be on my https portion of the server so i added it right below my 
> fastcgi_pass directive.
> http {
>         include         /etc/nginx/mime.types;
>         include         /etc/nginx/fastcgi_params;
>
> rest of regular config....
>
>         ##ssl portion
>         server {
>                 listen          443;
>                 server_name     domain.com www.domain.com;
>
>                 ssl on;
>                 ssl_certificate         /etc/ssl/nginx/server.crt;
>                 ssl_certificate_key     /etc/ssl/nginx/server.key;
>
>                 access_log      /var/log/nginx/domain.com.ssl_access_log 
> main;
>                 error_log       /var/log/nginx/domain.com.ssl_error_log 
> info;
>
>                 root /var/www/domain.com/htdocs;
>
>                 location ~ \.php$ {
>                         fastcgi_pass   127.0.0.1:8026;
>                         fastcgi_param  HTTPS    on;
>                         fastcgi_index   index.php;
>                 }
>
>                 location ~* ^.+\.(jpg|jpeg|gif|png)$ {
>                         access_log   off;
>                         expires      30d;
>                 }
>         }
> }
>
> reloaded the configuration file and hit refresh on a php page displaying 
> phpinfo()  and i get the "No Input file". So after playing around i ended 
> up having to add the include directive in my location ~\.php$ section like 
> so
>                 location ~ \.php$ {
>                         fastcgi_pass   127.0.0.1:8132;
> 			include /etc/nginx/fastcgi_params;
>                         fastcgi_param  HTTPS    on;
>                         fastcgi_index   index.php;
>                 }
>
>
>
> So it is looking like adding a fastcgi_param directive is clearing out the 
> http section for them.
> Also the English wiki states "Directives not set are inherited from the 
> outer level. " so that is why i am thinking this is a bug.

No, it's by design and clearly documented at least in russian 
docs.  Probably English wiki needs clarification here.

Basically, when you set array directive at certan level this 
clears everything inherited from upper levels for this array.  
This applies to other array directives as well (proxy_add_header, 
access_log, etc.). 

Maxim Dounin





More information about the nginx mailing list