Конфигурация nginx + php-fpm

Пример рабочей конфигурации. Данная конфигурация предполагает, что php-fpm работает через socket

 # ....
    sendfile on;     
   keepalive_timeout  65;     
   tcp_nodelay  on;     
   gzip	on;     
   gzip_min_length	1100;     
   gzip_disable "MSIE [1-6]\.(?!.*SV1)";     
   gzip_proxied	any;     
   gzip_comp_level	4;     
   gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;    
   gzip_vary  on;     
 # ....          

 upstream fpm_backend{ 	    
       server unix:/path/to/php-fpm.sock; 	
 }  	

 server { 		
    server_name yoursite.com www.yoursite.com; 		
    listen 81; 	
    charset utf8; 		
    index index.php index.html; 				 		
    location / { 		    
      root /path/to/site/www; 		    
      index index.php; 		   
      try_files $uri $uri/ @your_site; 		
   } 		 		

   location ~* ^.+\.(ico|txt|jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpeg|avi|zip|gz|bz2|rar|swf)$ {
      root /path/to/site/www; 			
      access_log off; 			
      expires max; 		
   } 		 		

   location ~ /.svn/ {
      deny all;
   }
   location /system/ {
      deny all;
   } 		
   location /.backups/ {
      deny all;
   }
   location /.cache/ {
      deny all;  
   }
   location /.log/ {
      deny all;
   }
   location /.tmp/ {
      deny all;
   }
   location /favicon.ico {
      allow all; 		    
      log_not_found off;
      access_log off;
   } 		
   location /robots.txt {
      allow all;
      log_not_found off;
      access_log off;
   } 		
   location ~ /\.ht {
      deny all;
   }
   location /webstat/ {
      deny all;
   }
   location ~ .php$ { 		    
        index index.php;
        root /path/to/site/www;
        fastcgi_split_path_info ^(.+\.php)(.*)$;
        fastcgi_pass fpm_backend;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param DOCUMENT_ROOT /path/to/site/www;
        fastcgi_param SCRIPT_FILENAME /path/to/site/www$fastcgi_script_name;
        fastcgi_param PATH_TRANSLATED /path/to/site/www$fastcgi_script_name;
        fastcgi_param QUERY_STRING $query_string;
        fastcgi_param REQUEST_METHOD $request_method;
        fastcgi_param CONTENT_TYPE $content_type;
        fastcgi_param CONTENT_LENGTH $content_length;
   } 		 		
   location @your_site{ 		    
        index index.php; 		    
        root /path/to/site/www; 		    
        fastcgi_pass fpm_backend;
        include fastcgi_params;
        fastcgi_param DOCUMENT_ROOT /path/to/site/www;
        fastcgi_param SCRIPT_FILENAME /path/to/site/www/index.php;
        fastcgi_param PATH_TRANSLATED /path/to/site/www/index.php;
        fastcgi_param QUERY_STRING $query_string;
        fastcgi_param REQUEST_METHOD $request_method;
        fastcgi_param CONTENT_TYPE $content_type; 		    
        fastcgi_param CONTENT_LENGTH $content_length;
        fastcgi_intercept_errors on;
        fastcgi_ignore_client_abort off;
        fastcgi_connect_timeout 60;
        fastcgi_send_timeout 180;
        fastcgi_read_timeout 180;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 4 256k;
        fastcgi_temp_file_write_size 256k;
   } 	
}