How-To: NGINX with PHP-FPM (FastCGI implementation) on debian lenny

PHP-FPM is PHP FastCGI implementation. It works great in combination with NGINX. This is a simple way to install it on lenny.

Update /etc/apt/sources.list according to this post.

Install packages:

apt-get update
apt-get install php5-fpm nginx

Update /etc/nginx/sites-enabled/default file with lines:

server {
 root /var/www/;

 location / {
 #root   /var/www/nginx-default;
 index  index.html index.htm index.php;

 location ~ \.php$ {
 fastcgi_index  index.php;

 include fastcgi_params;
 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 fastcgi_param SERVER_NAME $http_host;
 fastcgi_ignore_client_abort on;

 location ~ /\.ht {
 deny  all;


Restart servers:

/etc/init.d/php5-fpm restart
/etc/init.d/nginx restart

This way, phpmyadmin installation with apt-get won't work, because of apache dependency. Instructions on installing phpmyadmin manually can be found here.

Useful tools / links