This is an old revision of the document!


Installing & Enabling The LSCache Add-on For XenForo

  • LiteSpeed Web Server Enterprise Edition 5.0.12+.
  • LSCache Module. (Included with a 2-CPU or higher license. Can be purchased as an add-on for VPS, Ultra VPS, and 1-CPU licenses.)

LSCache

  1. From the WebAdmin Console, navigate to Configuration » Server » Cache and set Storage Path under “Cache Storage Settings”. For example: “/tmp/xfcache”

    If the directory does not already exist, it will be created for you.
  2. Under “Cache Policy” set the following:

    Enable Public Cache - No
    Check Public Cache - Yes
    Enable Private Cache - No
    Check Private Cache - No
    Ignore Request Cache-Control - Yes

    All other settings can be left as “Not Set”.

  3. Perform a Graceful Restart.
  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.

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

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

More Accurate Guest Count

Because pages are being served from cache, the members count portion of a page will likely appear slightly off 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 find out your session cookie name 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 tool 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 click on the “Network” tab in the inspector and reload 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 to “config.php” under XenForo's “library” directory:

$config['debug'] = true;


Note: It is not recommended to enable debug mode 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'] == '127.0.0.1'){$config['debug'] = true;}

Where you can replace 127.0.0.1 with the desired IP Address.

  • Admin
  • Last modified: 2016/02/04 21:22
  • by Michael Alegre