PHP fastcgi sninppet for Debian jessie
Francis Daly
francis at daoine.org
Tue Oct 7 13:31:29 UTC 2014
On Tue, Oct 07, 2014 at 12:00:00PM +0000, nginx-devel-request at nginx.org wrote:
Hi there,
> We are thinking about shipping a php-fastcgi snippet with the upcoming jessie
> debian stable release. I wanted to bring that to your attention to avoid
> shipping a broken config file that will be difficult to revert.
I think that any snippet will (potentially) be "right" for certain
circumstances, and will (almost certainly) be "wrong" for other
circumstances.
The hard part is (usually) defining what the one use case that you are
designing for is.
> the snippet:
> http://anonscm.debian.org/cgit/collab-maint/nginx.git/tree/debian/conf/snippets/fastcgi-php.conf?h=php-fastcgi&id=87f23062
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
machine.
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$".
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.
> the default site config that references it:
> http://anonscm.debian.org/cgit/collab-maint/nginx.git/tree/debian/conf/sites-available/default?h=php-fastcgi&id=87f23062
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
no-configuration default.
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.
> 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.
Cheers,
f
--
Francis Daly francis at daoine.org
More information about the nginx-devel
mailing list