PHP fastcgi sninppet for Debian jessie
yatiohi at ideopolis.gr
Wed Oct 8 08:09:10 UTC 2014
On Tue, Oct 07, 2014 at 02:31:29PM +0100, Francis Daly wrote:
>On Tue, Oct 07, 2014 at 12:00:00PM +0000, nginx-devel-request at nginx.org wrote:
>> the snippet:
> fastcgi_split_path_info ^(.+\.php)(/.+)$;
>is probably pointless if you have already matched "location ~ \.php$",
>as your example config indicates.
> try_files $fastcgi_script_name =404;
>seems unnecessary to me, unless your fastcgi server is configured to keep
>guessing what you might have meant, instead of just doing what you said
>and failing when you said something wrong. (I do not know how the
>jessie-default php fastcgi server is configured by default.)
>And it is almost certainly broken if your fastcgi server is on a separate
>With either of those lines removed, then the
> set $path_info $fastcgi_path_info;
> fastcgi_param PATH_INFO $path_info;
>dance is unnecessary.
>I think that
> fastcgi_index index.php;
>is probably also pointless within "location ~ \.php$".
Yes, it's pointless on a "location ~ \.php$" block, but this snippet can
be used in other locations as well, so I tried to be more generic. It
might be used in a named @php location and used as the last argument to
a try_files directive for example).
> include fastcgi.conf;
>is good; but the user should be aware how their fastcgi server handles
>repeated fastcgi_param values, if they are going to add their own that
>might clash with anything in that file -- if the fastcgi server only
>processes the first value, then they must add their own before this
>include; if it processes the last value, then they must add their own
>after this include.
Good point, we should add a comment about that to be clear.
>> the default site config that references it:
> listen 80 default_server;
> listen [::]:80 default_server ipv6only=on;
>Using both lines may or may not be necessary depending on the
>configuration of the kernel involved. And they are possibly the
>The "root" and "index" lines are probably also the compile-time defaults
>-- useful as an example "change this if you need to" indication, if the
>user does not want to refer to the documentation directly.
>The "server_name" directive does not do what the preceding comment says
>it does. (Unless I'm missing something.)
>Everything within the "location /" block is the default action anyway
>(except that this version, I think, hides things from log files). Probably
>simpler to erase them. (And maybe to remove the block entirely, but
>there are likely reasons not to do that.)
>The rest is commented fragments. Does /usr/share/nginx/html/50x.html
>exist on the default jessie? It is /usr/share/nginx/www/50x.html on a
>wheezy machine I have here.
Yes, the rest of the configuration file are relics from the past, and a
bit confusing... We plan to remove most of them :)
>> Any comments are wellcome!
>I hope this helps.
>You can go a long way with a mostly-empty nginx.conf.
>Note, though, that while I read this list, I'm not a nginx developer.
Thanks a lot for your time and comments!
More information about the nginx-devel