2

Is best to put the fastcgi_pass 127.0.0.1:9000 directive in the fastcgi_params file for NGiNX, or to explicitly state it in the location for \.php$?

Or does it not really matter?

tacotuesday
  • 1,389
  • 1
  • 16
  • 27

1 Answers1

3

You want to put it directly in the location block, because the fastcgi_params file is intended to be shared by multiple blocks which can pass to a different FastCGI server. The fastcgi_params also gets rid of the "noise" of all the paramater definitions which are not important most of the time, but the fastcgi_pass directive is always important when dealing with configurations. Lastly, the name fastcgi_params implies that it only contains fastcgi_param directives -- using it for other directives will confuse others (and probably you in a couple months) trying to understand the configuration.

mgorven
  • 30,615
  • 7
  • 79
  • 122
  • Good points. I was curious, because I felt the same way about the confusion part. [In their full example](http://wiki.nginx.org/FullExample) they have a `fastcgi_index` directive listed in their `fastcgi_conf` file, which I found rather odd. However, it is named `fastcgi_conf`, rather than `fastcgi_params`, which makes slightly more sense. – tacotuesday Aug 27 '12 at 23:47