nginx + php-fpm "modern configuration way"

Grégory Pakosz gpakosz at
Tue Apr 3 08:49:40 UTC 2012


Everyone knows there are many nginx tutorials out there and I would like to
know what's the "modern way" when writing a php location block, I'm doing
(nginx 1.1.:

location ~ \.php$ {
  try_files $uri =404;

  include fastcgi_params;
  fastcgi_pass unix:/var/run/php5-fpm/www-data.sock;

And it works pretty well. I quick tested phpinfo, drupal, joomla, wordpress
and they all run correctly with SEF urls etc.
However, I often see the following directives being used, how
important/useful are they?

fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list