multiple memcached upstream added to nginx sample

git-svn-id: http://plugins.svn.wordpress.org/wp-ffpc/trunk@676902 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
cadeyrn 2013-03-06 14:13:26 +00:00
parent 407d1ee995
commit 35fca7f41a
3 changed files with 21 additions and 8 deletions

View file

@ -1,4 +1,8 @@
http { http {
...
upstream memcached-servers {
MEMCACHED_SERVERS
}
... ...
server { server {
... ...
@ -24,7 +28,7 @@ http {
} }
if ( $memcached_request = 1) { if ( $memcached_request = 1) {
memcached_pass MEMCACHEDHOST:MEMCACHEDPORT; memcached_pass memcached-servers;
error_page 404 = @rewrites; error_page 404 = @rewrites;
} }

View file

@ -16,6 +16,7 @@ PHP has two extension for communication with a memcached server, named Memcache
= Features: = = Features: =
* exclude possibility of home, feeds, archieves, pages, singles * exclude possibility of home, feeds, archieves, pages, singles
* possibility to enable caching for logged-in users
* use APC or memcached as backend * use APC or memcached as backend
* 404 caching * 404 caching
* redirects caching * redirects caching
@ -23,20 +24,21 @@ PHP has two extension for communication with a memcached server, named Memcache
* shortlink HTTP header preservation * shortlink HTTP header preservation
* pingback HTTP header preservation(1) * pingback HTTP header preservation(1)
* fallback to no caching if any error or problem occurs * fallback to no caching if any error or problem occurs
* syslog & debug settings available
* supports multiple memcached backends
* Wordpress Network compatible(2) * Wordpress Network compatible(2)
* nginx compatible(3) * nginx compatible(3)
* (optional) syslog messages of sets-gets-flushes
(1) pingback hostname will always be generated from the accessed domain, otherwise speed would get highly compromised (1) pingback hostname will always be generated from the accessed domain, otherwise speed would get highly compromised
(2) If used in WordPress Network, the configuration will only be available for network admins at the network admin panel, and will be system-wide and will be applied for every blog. (2) If enabled as network-wide plugin in a WordPress Network, the configuration will only be available for network admins at the network admin panel, will be system-wide and will be applied for every blog.
(3) nginx compatility means that if used with PHP Memcache or PHP Memcached extension, the created memcached entries can be read and served directly from nginx, making the cache insanely fast. (3) nginx compatility means that if used with PHP Memcache or PHP Memcached extension, the created memcached entries can be read and served directly from nginx, making the cache insanely fast.
If used with APC, this feature is not available (no APC module for nginx), although, naturally, the cache modul is functional and working, but it will be done by PHP instead of nginx. If used with APC, this feature is not available (no APC module for nginx).
Short nginx example configuration is generated on the plugin settings page if Memcache or Memcached is selected as cache type. Short nginx example configuration is generated on the plugin settings page, under `nginx` tab.
NOTE: some features ( most of additional HTTP headers for example ) will not be available with this solution! ( yet ) NOTE: some features ( most of additional HTTP headers for example ) will not be available with this solution! ( yet )
Some parts were based on [Hyper Cache](http://wordpress.org/extend/plugins/hyper-cache "Hyper Cache") plugin by Satollo (info@satollo.net). Parts are based on [Hyper Cache](http://wordpress.org/extend/plugins/hyper-cache "Hyper Cache") plugin by Satollo (info@satollo.net).
== Installation == == Installation ==
1. Upload contents of `wp-ffpc.zip` to the `/wp-content/plugins/` directory 1. Upload contents of `wp-ffpc.zip` to the `/wp-content/plugins/` directory
@ -50,9 +52,10 @@ For WordPress Network, please visit the Network Admin panel, the options will be
= How to install memcache PHP extension? = = How to install memcache PHP extension? =
On most of the distributions, php5-memcached or php5-mecache is available as package. On most of the distributions, php5-memcached or php5-mecache is available as package.
You can use PECL alternatively: `pecl install memcached`. You can use PECL alternatively: `pecl install memcached`.
It's recommended to use memcached.
= How to use the plugin on Amazon Linux? = = How to use the plugin on Amazon Linux? =
You have to remove the default yum package, named `php-pecl-memcache` and install `Memcache` with PECL. You have to remove the default yum package, named `php-pecl-memcache` and install `Memcache` or `Memcached` through PECL.
== Changelog == == Changelog ==
@ -65,7 +68,7 @@ WARNING, MAJOR CHANGES!
* UI cleanup, introducing tabbed interface * UI cleanup, introducing tabbed interface
* WP-FFPC options moved from global menu to under Settings in both Site and Network Admin interfaces * WP-FFPC options moved from global menu to under Settings in both Site and Network Admin interfaces
* added 'persistent' checkbox for memcached connections * added 'persistent' checkbox for memcached connections
* added possibility to add multiple memcached servers * added support for multiple memcached servers, feature request from ivan.buttinoni ( ivanbuttinoni @ WordPress.org forum )
* case-sensitive string checks replaced with case-insensitives, contribution of Mark Costlow <cheeks@swcp.com> * case-sensitive string checks replaced with case-insensitives, contribution of Mark Costlow <cheeks@swcp.com>
* refactored settings saving mechanism * refactored settings saving mechanism
* additional syslog informations * additional syslog informations

View file

@ -465,6 +465,12 @@ if (!class_exists('WPFFPC')) {
$nginx = file_get_contents ( WP_FFPC_DIR .'/nginx-sample.conf' ); $nginx = file_get_contents ( WP_FFPC_DIR .'/nginx-sample.conf' );
$nginx = str_replace ( $search , $replace , $nginx ); $nginx = str_replace ( $search , $replace , $nginx );
foreach ( array_keys( $this->options['servers'] ) as $server ) {
$nginx_servers .= " server ". $server .";\n";
}
$nginx = str_replace ( 'MEMCACHED_SERVERS' , $nginx_servers , $nginx );
?> ?>
<pre><?php echo $nginx; ?></pre> <pre><?php echo $nginx; ?></pre>
</fieldset> </fieldset>