PHP fastcgi sninppet for Debian jessie

Peter Wu peter at lekensteyn.nl
Tue Oct 7 11:33:26 UTC 2014


On Tuesday 07 October 2014 13:22:56 Christos Trochalakis wrote:
> Hello all,
> 
> 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.
> 
> the snippet:
> http://anonscm.debian.org/cgit/collab-maint/nginx.git/tree/debian/conf/snippets/fastcgi-php.conf?h=php-fastcgi&id=87f23062
> 
> 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
> 
> Any comments are welcome!

It looks functional (though the PATH_INFO config looks like a workaround for a
bug, couldn't that bug/feature be fixed instead?).

Why do you have a separate fastcgi.conf while fastcgi_params already exists?
Actually, it seems that Igor Sysoev added this file in December 2009. Igor, why
is the file duplicated if the only difference is in SCRIPT_FILENAME?

Christos, the configuration example allows for execution of xyz.php files in the
document root. Another case is the use of frameworks which have a single
controller, such as FuelPHP and Laravel. In such cases, this nginx configuration
is sufficient (using the old config):

    location ~ ^/($|api/|user/|...) {
        try_files $uri @php_router;
    }
    location @php_router {
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME /path/to/php/controller.php;
        fastcgi_pass unix:/var/run/php5-fpm.app.sock;
    }

If you do not set fastcgi_param in the location section, then you can also
mention this in the server section (or the http section if location does not set
fastcgi_param either). (fastcgi_param is *not* inherited but overidden by new
directives in a lower block).
-- 
Kind regards,
Peter
https://lekensteyn.nl



More information about the nginx-devel mailing list