= 1.10.1 =

*2015-10-30*

* fixed nginx configuration sample snippets
* nginx configuration moved from Settings tab to Help tab, so if you're looking for the "nginx" tab, you need to look under "Help" on the WP-FFPC Settings page.
This commit is contained in:
Peter Molnar 2015-10-30 15:41:37 +00:00
parent 06bee4b178
commit 62f3d0ab00
4 changed files with 129 additions and 114 deletions

View file

@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
Tags: cache, page cache, full page cache, nginx, memcached, apc, speed
Requires at least: 3.0
Tested up to: 4.3.1
Stable tag: 1.10.0
Stable tag: 1.10.1
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html
@ -80,6 +80,7 @@ Many thanks for donations, contributors, supporters, testers & bug reporters:
* Christian Kernbeis
* Gausden Barry
* Maksim Bukreyeu
* Lissome Hong Kong Limited
== Installation ==
@ -129,6 +130,12 @@ Version numbering logic:
* every .B version indicates new features.
* every ..C indicates bugfixes for A.B version.
= 1.10.1 =
*2015-10-30*
* fixed nginx configuration sample snippets
* nginx configuration moved from Settings tab to Help tab, so if you're looking for the "nginx" tab, you need to look under "Help" on the WP-FFPC Settings page.
= 1.10.0 =
*2015-10-23*

View file

@ -261,6 +261,8 @@ class WP_FFPC extends WP_FFPC_ABSTRACT {
}
}
}
add_filter('contextual_help', array( &$this, 'plugin_admin_nginx_help' ), 10, 2);
}
/**
@ -371,6 +373,28 @@ class WP_FFPC extends WP_FFPC_ABSTRACT {
return $contextual_help;
}
/**
* admin help panel
*/
public function plugin_admin_nginx_help($contextual_help, $screen_id ) {
/* add our page only if the screenid is correct */
if ( strpos( $screen_id, $this->plugin_settings_page ) ) {
$content = __('<h3>Sample config for nginx to utilize the data entries</h3>', 'wp-ffpc');
$content .= __('<div class="update-nag">This is not meant to be a copy-paste configuration; you most probably have to tailor it to your needs.</div>', 'wp-ffpc');
$content .= __('<div class="update-nag"><strong>In case you are about to use nginx to fetch memcached entries directly and to use SHA1 hash keys, you will need an nginx version compiled with <a href="http://wiki.nginx.org/HttpSetMiscModule">HttpSetMiscModule</a>. Otherwise set_sha1 function is not available in nginx.</strong></div>', 'wp-ffpc');
$content .= '<code><pre>' . $this->nginx_example() . '</pre></code>';
get_current_screen()->add_help_tab( array(
'id' => 'wp-ffpc-nginx-help',
'title' => __( 'nginx example', 'wp-ffpc' ),
'content' => $content,
) );
}
return $contextual_help;
}
/**
* admin panel, the admin page displayed for plugin settings
*/
@ -781,12 +805,6 @@ class WP_FFPC extends WP_FFPC_ABSTRACT {
</dl>
</fieldset>
<fieldset id="<?php echo $this->plugin_constant ?>-nginx">
<legend><?php _e('Sample config for nginx to utilize the data entries', 'wp-ffpc'); ?></legend>
<div class="update-nag"><strong>In case you are about to use nginx to fetch memcached entries directly and to use SHA1 hash keys, you will need an nginx version compiled with <a href="http://wiki.nginx.org/HttpSetMiscModule">HttpSetMiscModule</a>. Otherwise set_sha1 function is not available in nginx.</strong></div>
<pre><?php echo $this->nginx_example(); ?></pre>
</fieldset>
<fieldset id="<?php echo $this->plugin_constant ?>-precache">
<legend><?php _e('Precache settings & log from previous pre-cache generation', 'wp-ffpc'); ?></legend>
@ -909,7 +927,6 @@ class WP_FFPC extends WP_FFPC_ABSTRACT {
'debug' => __( 'Debug & in-depth', 'wp-ffpc'),
'exceptions' => __( 'Cache exceptions', 'wp-ffpc'),
'servers' => __( 'Backend settings', 'wp-ffpc'),
'nginx' => __( 'nginx', 'wp-ffpc'),
'precache' => __( 'Precache & precache log', 'wp-ffpc')
);
@ -1121,7 +1138,7 @@ class WP_FFPC extends WP_FFPC_ABSTRACT {
$nginx = str_replace ( 'RESPONSE_HEADER' , '' , $nginx );
}
return $nginx;
return htmlspecialchars($nginx);
}
/**

View file

@ -1,52 +1,11 @@
http {
# memcached servers, generated according to wp-ffpc config
upstream memcached-servers {
MEMCACHED_SERVERS
}
# PHP-FPM upstream; change it accordingly to your local config!
upstream php-fpm {
server 127.0.0.1:9000;
}
server {
## 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;
# --- 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_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param SCRIPT_NAME $script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
@ -58,19 +17,35 @@ MEMCACHED_SERVERS
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 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;
# 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;
default_type text/html;
# --- 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
@ -93,24 +68,40 @@ MEMCACHED_SERVERS
COOKIES_EXCEPTION
location ~ ^(?<script_name>.+?\.php)(?<path_info>.*)$ {
default_type text/html;
if ( $memcached_request = 1) {
RESPONSE_HEADER
memcached_pass memcached-servers;
error_page 404 = @nocache;
break;
memcached_pass memcached;
error_page 404 = @fallback;
}
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
location @nocache {
add_header X-Cache-Engine "not cached";
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_split_path_info ^(?<script_name>.+?\.php)(?<path_info>.*)$;
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/ /index.php;
try_files $uri $uri/ @rewrites;
}
location @fallback {
# add_header X-Cache-Engine "WP-FFPC nginx via memcached - fallback - not cached";
fastcgi_split_path_info ^(?<script_name>.+?\.php)(?<path_info>.*)$;
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;
}

View file

@ -3,7 +3,7 @@
Plugin Name: WP-FFPC
Plugin URI: https://github.com/petermolnar/wp-ffpc
Description: WordPress in-memory full page cache plugin
Version: 1.10.0
Version: 1.10.1
Author: Peter Molnar <hello@petermolnar.eu>
Author URI: http://petermolnar.eu/
License: GPLv3