Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
litespeed_wiki:cache:lscache:wordpress [2015/10/12 15:50] Michael Alegre [Server Level Settings] |
litespeed_wiki:cache:lscache:wordpress [2017/01/03 21:31] Michael Alegre removed |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== LSCache + WordPress Configuration ====== | ====== LSCache + WordPress Configuration ====== | ||
+ | |||
+ | **Note: This page describes an easy way to set up simple caching for WordPress installations. With the release of LiteSpeed Cache for WordPress, though, this solution is now deprecated. Click [[litespeed_wiki:cache:lscwp|here]] for the LiteSpeed Cache for WordPress installation and configuration manual.** | ||
LSCache, similar to Varnish cache, is a simpler and more efficient page caching solution built-in to LiteSpeed Web Server. When used in conjunction with WordPress, the Internets leading content management system, you can expect significant performance gains with a quick and easy setup. Cache management is also made significantly easier and more flexible with the ability to use rewrite rules to customize LSCache's behavior. | LSCache, similar to Varnish cache, is a simpler and more efficient page caching solution built-in to LiteSpeed Web Server. When used in conjunction with WordPress, the Internets leading content management system, you can expect significant performance gains with a quick and easy setup. Cache management is also made significantly easier and more flexible with the ability to use rewrite rules to customize LSCache's behavior. | ||
Line 15: | Line 17: | ||
It is recommended that this directory be on a dedicated disk or disk array in RAID 0 configuration. | It is recommended that this directory be on a dedicated disk or disk array in RAID 0 configuration. | ||
- | |||
- | |||
- | **Note:** You will need to create the desired directory before setting it as the **Storage Path** through the WebAdmin. Do this through the command line. | ||
For example: | For example: | ||
Line 42: | Line 41: | ||
<IfModule LiteSpeed> | <IfModule LiteSpeed> | ||
- | # The following line is okay but can be omitted | ||
- | CacheEnable public / | ||
RewriteEngine on | RewriteEngine on | ||
RewriteCond %{REQUEST_METHOD} ^(HEAD|GET)$ | RewriteCond %{REQUEST_METHOD} ^(HEAD|GET)$ | ||
- | RewriteCond %{REQUEST_URI} !^(wp-admin|wp-login.php|wp-cron.php) | + | RewriteCond %{REQUEST_URI} !^/(wp-admin|wp-login.php|wp-cron.php) |
RewriteCond %{HTTP_COOKIE} !wordpress_logged_in_ | RewriteCond %{HTTP_COOKIE} !wordpress_logged_in_ | ||
RewriteRule .* - [E=Cache-Control:max-age=120] | RewriteRule .* - [E=Cache-Control:max-age=120] | ||
Line 59: | Line 56: | ||
RewriteEngine on | RewriteEngine on | ||
RewriteCond %{REQUEST_METHOD} ^(HEAD|GET)$ | RewriteCond %{REQUEST_METHOD} ^(HEAD|GET)$ | ||
- | RewriteCond %{REQUEST_URI} !^(wp-admin|wp-login.php|wp-cron.php) | + | RewriteCond %{REQUEST_URI} !^/(wp-admin|wp-login.php|wp-cron.php) |
RewriteCond %{HTTP_COOKIE} !wordpress_logged_in_ | RewriteCond %{HTTP_COOKIE} !wordpress_logged_in_ | ||
RewriteRule ^$ - [E=Cache-Control:max-age=60,S=1] | RewriteRule ^$ - [E=Cache-Control:max-age=60,S=1] | ||
Line 74: | Line 71: | ||
<IfModule LiteSpeed> | <IfModule LiteSpeed> | ||
RewriteEngine on | RewriteEngine on | ||
- | RewriteCond %{HTTP_USER_AGENT} android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge\ |maemo|midp|mmp|opera\ m(ob|in)i|palm(\ os)?|pho$ | + | RewriteCond %{HTTP_USER_AGENT} android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge\ |maemo|midp|mmp|opera\ m(ob|in)i|palm(\ os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows\ (ce|phone)|xda|xiino [NC,OR] |
RewriteRule .* - [E=Cache-Control:vary=ismobile] | RewriteRule .* - [E=Cache-Control:vary=ismobile] | ||
RewriteCond %{REQUEST_METHOD} ^(HEAD|GET)$ | RewriteCond %{REQUEST_METHOD} ^(HEAD|GET)$ | ||
- | RewriteCond %{REQUEST_URI} !^(wp-admin|wp-login.php|wp-cron.php) | + | RewriteCond %{REQUEST_URI} !^/(wp-admin|wp-login.php|wp-cron.php) |
RewriteCond %{HTTP_COOKIE} !wordpress_logged_in_ | RewriteCond %{HTTP_COOKIE} !wordpress_logged_in_ | ||
RewriteRule .* - [E=Cache-Control:max-age=120] | RewriteRule .* - [E=Cache-Control:max-age=120] | ||
</IfModule> | </IfModule> | ||
+ | |||
+ | **Important:** Your rewrite rules must exactly match your backend's mobile detection. If these do not match, you may run into the issue where your rewrite rules think that a device is mobile while the backend does not and visa-versa. This can cause, for example, the desktop version of a page to be cached and flagged as the mobile version which will then be wrongly served to all mobile viewers. | ||
**Note:** "E=Cache-Control:vary=ismobile" is available as of LSWS version 5.0.7. | **Note:** "E=Cache-Control:vary=ismobile" is available as of LSWS version 5.0.7. |