# --- contents of {nginx config dir, usuall /etc/nginx}/fastcgi_params --- fastcgi_param SCRIPT_NAME $script_name; fastcgi_param PATH_INFO $path_info; 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_param SCRIPT_NAME $script_name; fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param GATEWAY_INTERFACE CGI/1.1; fastcgi_param SERVER_SOFTWARE nginx; fastcgi_param REMOTE_ADDR $remote_addr; fastcgi_param REMOTE_PORT $remote_port; fastcgi_param SERVER_ADDR $server_addr; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_NAME $server_name; fastcgi_param HTTPS $https if_not_empty; fastcgi_param SSL_PROTOCOL $ssl_protocol if_not_empty; fastcgi_param SSL_CIPHER $ssl_cipher if_not_empty; fastcgi_param SSL_SESSION_ID $ssl_session_id if_not_empty; fastcgi_param SSL_CLIENT_VERIFY $ssl_client_verify if_not_empty; fastcgi_param REDIRECT_STATUS 200; fastcgi_index index.php; fastcgi_connect_timeout 10; fastcgi_send_timeout 360; fastcgi_read_timeout 3600; fastcgi_buffer_size 512k; fastcgi_buffers 512 512k; fastcgi_intercept_errors on; # --- part needs to go inside the http { } block of nginx --- # --- memcached --- upstream memcached { MEMCACHED_SERVERS } # --- PHP-FPM upstream --- change it accordingly to your local config! upstream php-fpm { server 127.0.0.1:9000; } # --- part needs to go inside the server { } block of nginx --- set $memcached_raw_key KEYFORMAT; HASHEDORNOT set $memcached_request 1; if ($request_method = POST ) { set $memcached_request 0; } if ( $uri ~ "/wp-" ) { set $memcached_request 0; } if ( $args ) { set $memcached_request 0; } LOGGEDIN_EXCEPTION COOKIES_EXCEPTION location ~ ^(?.+?\.php)(?.*)$ { default_type text/html; if ( $memcached_request = 1) { RESPONSE_HEADER memcached_pass memcached; error_page 404 = @fallback; } fastcgi_split_path_info ^(?.+?\.php)(?.*)$; fastcgi_param SCRIPT_FILENAME $document_root$script_name; fastcgi_param PATH_TRANSLATED $document_root$path_info; include params/fastcgi; fastcgi_keep_conn on; fastcgi_pass php-fpm; } location / { try_files $uri $uri/ @rewrites; } location @fallback { # add_header X-Cache-Engine "WP-FFPC nginx via memcached - fallback - not cached"; fastcgi_split_path_info ^(?.+?\.php)(?.*)$; fastcgi_param SCRIPT_FILENAME $document_root$script_name; fastcgi_param PATH_TRANSLATED $document_root$path_info; include fastcgi_params; fastcgi_keep_conn on; fastcgi_pass php-fpm; } location @rewrites { rewrite ^ /index.php last; }