2013-03-19 10:16:59 +00:00
|
|
|
http {
|
2013-04-04 11:15:47 +01:00
|
|
|
|
|
|
|
# memcached servers, generated according to wp-ffpc config
|
2013-03-19 10:16:59 +00:00
|
|
|
upstream memcached-servers {
|
|
|
|
MEMCACHED_SERVERS
|
|
|
|
}
|
2013-04-04 11:15:47 +01:00
|
|
|
|
|
|
|
# PHP-FPM upstream; change it accordingly to your local config!
|
|
|
|
upstream php-fpm {
|
|
|
|
server 127.0.0.1:9000;
|
|
|
|
}
|
|
|
|
|
2013-03-19 10:16:59 +00:00
|
|
|
server {
|
2013-04-04 11:15:47 +01:00
|
|
|
## Listen ports
|
|
|
|
listen 80;
|
|
|
|
listen [::]:80;
|
|
|
|
|
|
|
|
# use _ if you want to accept everything, or replace _ with domain
|
|
|
|
server_name _;
|
|
|
|
|
|
|
|
# root of WordPress
|
|
|
|
root SERVERROOT;
|
|
|
|
|
|
|
|
# set up logging
|
|
|
|
access_log /var/log/nginx/SERVERLOG.access.log;
|
|
|
|
error_log /var/log/nginx/SERVERLOG.error.log;
|
|
|
|
|
|
|
|
## PHP5-FPM
|
|
|
|
location ~ (\.php) {
|
|
|
|
# these settings are usually in fastcgi_params
|
|
|
|
|
|
|
|
fastcgi_index index.php;
|
|
|
|
fastcgi_connect_timeout 10;
|
|
|
|
fastcgi_send_timeout 180;
|
|
|
|
fastcgi_read_timeout 180;
|
|
|
|
fastcgi_buffer_size 512k;
|
|
|
|
fastcgi_buffers 4 256k;
|
|
|
|
fastcgi_busy_buffers_size 512k;
|
|
|
|
fastcgi_temp_file_write_size 512k;
|
|
|
|
fastcgi_intercept_errors on;
|
|
|
|
fastcgi_split_path_info ^(.+\.php)(/.*)$;
|
|
|
|
fastcgi_keep_conn on;
|
|
|
|
|
|
|
|
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_FILENAME $document_root$fastcgi_script_name;
|
|
|
|
fastcgi_param SCRIPT_NAME $fastcgi_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 PATH_INFO $fastcgi_path_info;
|
|
|
|
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
|
|
|
|
fastcgi_param REDIRECT_STATUS 200;
|
|
|
|
|
|
|
|
# uncomment these for HTTPS usage
|
|
|
|
#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;
|
|
|
|
|
2014-09-12 16:41:08 +01:00
|
|
|
default_type text/html;
|
2015-05-07 13:33:32 +01:00
|
|
|
|
|
|
|
set $memcached_raw_key KEYFORMAT;
|
|
|
|
|
|
|
|
HASHEDORNOT
|
|
|
|
|
2014-09-12 16:41:08 +01:00
|
|
|
set $memcached_request 1;
|
2013-04-04 11:15:47 +01:00
|
|
|
|
2014-09-12 16:41:08 +01:00
|
|
|
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
|
|
|
|
|
|
|
|
if ( $memcached_request = 1) {
|
|
|
|
RESPONSE_HEADER
|
|
|
|
memcached_pass memcached-servers;
|
|
|
|
error_page 404 = @nocache;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
fastcgi_pass unix:/var/run/php5-fpm.sock;
|
2013-04-04 11:15:47 +01:00
|
|
|
}
|
2013-03-19 10:16:59 +00:00
|
|
|
|
2014-09-12 16:41:08 +01:00
|
|
|
location @nocache {
|
|
|
|
add_header X-Cache-Engine "not cached";
|
|
|
|
fastcgi_pass unix:/var/run/php5-fpm.sock;
|
2013-03-19 10:16:59 +00:00
|
|
|
}
|
|
|
|
|
2014-09-12 16:41:08 +01:00
|
|
|
location / {
|
|
|
|
try_files $uri $uri/ /index.php;
|
2013-03-19 10:16:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|