sudo apt-get install php5-fpm

sudo nano /etc/php5/fpm/pool.d/www.conf

listen = /var/run/php5-fpm.sock

or

listen = 127.0.0.1:9001

sudo nano /etc/nginx/sites-available/default

server {
 listen 9000 default_server;
 listen [::]:9000 default_server ipv6only=off;
root /usr/share/nginx/html;
 #root /var/www
 index index.php index.html index.htm;

# Make site accessible from http://localhost/
 server_name localhost;
location / {
 # First attempt to serve request as file, then
 # as directory, then fall back to displaying a 404.
 try_files $uri $uri/ =404;
 # Uncomment to enable naxsi on this location
 # include /etc/nginx/naxsi.rules
 }
# Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
 #location /RequestDenied {
 # proxy_pass http://127.0.0.1:8080;
 #}
 #error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
 #
 error_page 500 502 503 504 /50x.html;
 location = /50x.html {
 root /usr/share/nginx/html;
 }
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
 #
location ~ \.php$ {
 fastcgi_split_path_info ^(.+\.php)(/.+)$;
 # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
try_files $uri =404;
 #fastcgi_pass unix:/var/run/php5-fpm.sock;
 fastcgi_pass 127.0.0.1:9001;
 fastcgi_index index.php;
 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 include fastcgi_params;
 }
 # deny access to .htaccess files, if Apache's document root
 # concurs with nginx's one
 #
 #location ~ /\.ht {
 # deny all;
 #}
}

Use the socket:

fastcgi_pass unix:/var/run/php5-fpm.sock;

or the IP adrress:

fastcgi_pass 127.0.0.1:9001;

 

sudo nano /etc/php5/fpm/php.ini

[...]
; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI.  PHP's
; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok
; what PATH_INFO is.  For more information on PATH_INFO, see the cgi specs.  Setting
; this to 1 will cause PHP CGI to fix its paths to conform to the spec.  A setting
; of zero causes PHP to behave as before.  Default is 1.  You should fix your scripts
; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.
; http://php.net/cgi.fix-pathinfo
cgi.fix_pathinfo=0
[...]

 

To control the php5-fom service:
sudo service php5-fpm start/stop/restart

Configuration file:

sudo nano /etc/php5/fpm/php-fpm.conf

Nginx error log file:

sudo nano /var/log/nginx/error.log

Php5-fpm sock file location:

/var/run/php5-fpm.sock

Kill php5-fom processes:

sudo killall php5-fpm