Actions

Help

Difference between revisions of "How To Set Up LSCache For WordPress"

From OpenLiteSpeed Wiki

(Virtual Host Configuration)
(Virtual Host Configuration)
Line 33: Line 33:
 
*Gracefully restart your server.
 
*Gracefully restart your server.
  
=== Virtual Host Configuration ===
+
=== Rewrite Configuration ===
 
*Navigate to Virtual Hosts in your Web Admin Console
 
*Navigate to Virtual Hosts in your Web Admin Console
 
*Click on the name of your WordPress Virtual Host.
 
*Click on the name of your WordPress Virtual Host.

Revision as of 14:00, 29 July 2016

This guide will take you through the steps to configure OpenLiteSpeed's cache module, install and activate the LSCache for WordPress plugin, and modify a virtual host to use a .htaccess file for your WordPress installation.

Pre-Installation Requirements

  • OpenLiteSpeed Web Server 1.4.19+ installed
  • WordPress installed
  • Virtual Host set up
  • Listener set up

We recommend using the ols1clk script whenever possible to quickly and easily install these requirements. If you used the script to install these, you should only have to modify the cache module's settings in the next section and enable the LiteSpeed Cache for WordPress plugin and your cache should work.

Cache Module Configuration

  • Navigate to Server Configuration > Modules in your Web Admin Console.
  • Click the Add button.
  • In the Module field, type cache
  • Copy and paste the following text into the Module Parameters field:
enableCache 0
qsCache 1
reqCookieCache 1
respCookieCache 1
ignoreReqCacheCtrl 1
ignoreRespCacheCtrl 0
enablePrivateCache 0
privateExpireInSeconds 1000
expireInSeconds 1000
storagePath cachedata
checkPrivateCache 1
checkPublicCache 1
  • Click the Save button.
  • Gracefully restart your server.

Rewrite Configuration

  • Navigate to Virtual Hosts in your Web Admin Console
  • Click on the name of your WordPress Virtual Host.
  • If your WordPress is in a context, click the Context tab and modify the following settings:
Enable Rewrite: Yes
Rewrite Inherit: Yes
Rewrite Rules: rewriteFile           /usr/local/lsws/wordpress/.htaccess
  • If your WordPress is not in a context, you should click the Rewrite tab and modify the following settings:
Enable Rewrite: Yes
Rewrite Rules: rewriteFile           /usr/local/lsws/wordpress/.htaccess

LiteSpeed Cache WordPress Plugin

  • Navigate to your WordPress Admin Dashboard (yoursite/wp-admin) and log in.
  • Click on Plugins > Add New.
  • Search for LiteSpeed Cache
  • Click on the Install button under the LiteSpeed Cache plugin name.
  • Next click the "Activate Plugin" link.

Verify That The Cache Setup Is Correct

  • Log out of your site and navigate to its homepage.
  • Right-click and Inspect.
  • Refresh the page.
  • After the page loads, click the Network tab from the Inspector.
  • Locate and click on the resource that contains your URL.
  • Click the Headers sub-tab.
  • Scroll down to the Response Headers section. You should see the following Response Headers:

X-LiteSpeed-Cache: hit and X-LiteSpeed-Cache-Control: public,max-age=1800

Where 1800 is your site's Front Page TTL Setting in the WordPress Plugin.