This article is about setting up Nginx + PHP-FastCGI on Debian 6.0.6 Squeeze

Step1. Install nginx and php5-cgi :

apt-get install nginx php5-cgi

Step2. Replace Nginx default virtualhosts config with the following content:

server {
listen [::]:80;
root /var/www/;
index index.html index.htm index.php;
access_log /var/log/;

location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/tmp/php.socket;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;

NOTE: Replace with your own domain.

Step3. Create a  Debian init script to control the php-cgi daemon.

Continue Reading…