Installing & Enabling The LSCache Add-on For XenForo

  • LiteSpeed Web Server Enterprise Edition 5.0.12+.
  • LSCache Module. (Included with all current licenses as well as the 8-CPU legacy license. Can be purchased as an add-on for VPS, Ultra VPS, and 1-CPU legacy licenses.)

Please refer to the Web Server section of the LiteSpeed Web Cache Common Installation Guide.

  1. Disable any other page caches as these will interfere with LSCXF.
  2. Download the LSCXF Add-on and unzip it's contents.

    Note: You will need a XenForo account to download the add-on.
  3. Access the server hosting your XenForo installation, either directly or using ssh/sftp.
  4. From the unzipped LSCXF folder, copy all files under upload » library to the library folder of your XenForo installation.

    Note: Do not copy the “library” folder itself, only it's contents!
  5. While not necessary for installation, it is also recommended that you create an “Add-ons” folder in your XenForo directory and place the unzipped LSCXF folder inside.
  6. Log in to your XenForo Admin panel and select “Install Add-on” under “Add-ons” in the Home menu.
  7. Click “Choose File” next to “Install from uploaded file” and select the XML file from your unzipped folder.
  8. Click “Install Add-on”. Xenforo will now create the needed structure for the add-on based on the XML file provided.

LSCXF will be enabled by default with a Public TTL of 60 seconds. You can enable/disable LSCXF from “List Add-ons” under “Add-ons” in the Home menu.

Note: If you are using any of our other LiteSpeed Cache plugins, please see Handling Logged-in Cookie Conflicts.

All configuration options for the LiteSpeed Cache Plugin for XenForo can be found under LiteSpeed Cache » Settings in the Home menu.

You only need to set the Public TTL (seconds) setting in the XenForo plugin and the Storage Path setting in the Configuration > Server > Cache tab of your LiteSpeed Web Server Web Admin Console. All other configuration settings can be left as “Not Set”.

Public TTL (seconds) [min value: 60] - Maximum time in seconds before a cached item is considered stale.

Enabling LSCache For Certain Sites Only

If you are a shared hosting provider running LiteSpeed Web Server, there is a good chance that you host more than just WordPress sites. In these cases you would want to enable caching through LSCache only for compatible sites like WordPress and XenForo.

You can do this by setting Check Public Cache to “No” at the server level (Configuration > Server > Cache > Cache Policy in the LiteSpeed Web Server Web Admin), and then modifying the sites .htaccess file to include the following:

<IfModule LiteSpeed>
CacheLookup public on

This will turn on CacheLookup for only this site, enabling you to selectively enable LSCache.

More Accurate Guest Count

Because pages are being served from cache, the member count portion of your pages will likely appear slightly inaccurate for non-logged in users until the currently cached page expires and a fresh copy of the page is requested. Likewise, when non-logged in users visit your site and are only served pages from cache, they never hit the backend and as such are not added to the guest count. This can cause the recorded guest number to be very different than the actual number of guests visiting your site. In this case you can use Google's Real-Time stats to see the actual number.

While serving guests only from cache can increase site performance, you may prefer to have this number accurately displayed on your site instead. This can be accomplished using a rewrite rule to force a guest to hit the backend the first time they visit your site.

Simply add the following to your .htaccess file:

RewriteCond %{HTTP_COOKIE} !xf_session [NC]
RewriteRule (.*)?$ - [E=Cache-Control:no-cache]

Note: “xf_session” is the default session cookie for XenForo. If you have set a customized cookie prefix you will need to replace “xf” with your custom prefix. For example: “customprefix_session”.

You can determine the name of your session cookie by right clicking on a page and using your browser's inspect tool. Once the tool is open, click on the network tab and refresh the page. You should now be able to click on the served 200 page and view what cookies are currently set.

You can check if a page is being served from LSCXF by using your browser's developer tools to check the response header for the HTML file. This can usually be done by right clicking on the page and selecting some form of “Inspect”. Then clicking on the “Network” tab in the inspector and reloading the page. If you see “X-LiteSpeed-Cache: hit” in the response header for the HTML file (usually listed first), then the page is being served by LSCXF.

To enable debug mode in XenForo, add the following lines to your “config.php” file under XenForo's “library” directory:

$config['debug'] = true;

Note: Enabling debug mode is not recommended on a production site as it will increase resource utilization.

If you would like to enable debug mode only for certain IPs, you can instead add the following:

if($_SERVER['REMOTE_ADDR'] == ''){$config['debug'] = true;}

Replacing with the desired IP Address.

  • Admin
  • Last modified: 2019/05/17 14:37
  • by Kacey Schroeder