Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
litespeed_wiki:cache:lscdrupal [2018/03/16 18:11] Jackson Zhang [Public Cache TTL] |
litespeed_wiki:cache:lscdrupal [2018/12/11 14:34] Jackson Zhang |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== LiteSpeed Cache for Drupal 8 ====== | ====== LiteSpeed Cache for Drupal 8 ====== | ||
+ | |||
+ | **NOTE: This plugin is only for Drupal 8. If you are running an earlier version of Drupal, you will need to use [[litespeed_wiki:cache:no-plugin-drupal|LSCache via rewrite rules]].** | ||
Drupal 8 is significantly changed from Drupal 7. The developers switched from procedural programming to object-oriented programming. Drupal 8 has a built-in page cache (for static content) and a dynamic page cache for logged in users. The latter basically works as a reverse proxy written in PHP. The built-in proxy is good if you have no other options, however, with the LiteSpeed Cache plugin you will see a great improvement in performance for your Drupal 8 site. | Drupal 8 is significantly changed from Drupal 7. The developers switched from procedural programming to object-oriented programming. Drupal 8 has a built-in page cache (for static content) and a dynamic page cache for logged in users. The latter basically works as a reverse proxy written in PHP. The built-in proxy is good if you have no other options, however, with the LiteSpeed Cache plugin you will see a great improvement in performance for your Drupal 8 site. | ||
Line 13: | Line 15: | ||
Download the LiteSpeed Cache Module to your local computer from [[https://github.com/litespeedtech/lscache-drupal/archive/master.zip|our GitHub repository]]. | Download the LiteSpeed Cache Module to your local computer from [[https://github.com/litespeedtech/lscache-drupal/archive/master.zip|our GitHub repository]]. | ||
- | =====Enable LiteSpeedCache using rewrite rules===== | + | =====Enable LiteSpeedCache lookup by placing the following to .htaccess at Doc_Root ===== |
+ | |||
+ | Place the following into .htaccess: | ||
<code> | <code> | ||
Line 33: | Line 37: | ||
* Check the checkbox next to ''LiteSpeed Cache''. | * Check the checkbox next to ''LiteSpeed Cache''. | ||
* Click **Install**. | * Click **Install**. | ||
+ | |||
+ | ===== Verify/Test if LiteSpeed cache is working or not ===== | ||
+ | You will need to check the response header "X-LiteSpeed-Cache: hit" from browser developer tools to ensure LiteSpeed cache is working. | ||
+ | |||
+ | You can verify a page is being served from LiteSpeed cache through the following steps: | ||
+ | |||
+ | - Open the Chrome/Firefox developer tools on a non-logged-in browser and navigate to your site. Open the Network tab. | ||
+ | - Refresh the page. | ||
+ | - Click the first resource (this should be an HTML file and the resource's headers should appear) and ensure you can see "X-LiteSpeed-Cache: hit" | ||
+ | - If you see "X-LiteSpeed-Cache: miss", refresh the page and check the header again. | ||
+ | - If you can not see "X-LiteSpeed-Cache: hit" header and it means LiteSpeed is not working yet/not enable properly yet. Please go back to the above steps to see if any steps missed. | ||
=====Configuration===== | =====Configuration===== | ||
Line 63: | Line 78: | ||
- | ===== Possible Installation Error and fix ===== | + | ===== Troubleshooting ===== |
- | ==== 500 error ==== | + | |
- | Install failed from browser, check the server error log, it shows: | + | ==== Installation Errors ==== |
- | [STDERR] Error: Class 'ZipArchive' not found in /var/www/html/core/lib/Drupal/Core/Archiver/Zip.php on line 30 #0 /var/www/html/core/lib/Drupal/Core/Archiver/ArchiverManager.php(42): Drupal\Core\Archiver\Zip->__construct('/tmp/lscache-dr...') | + | |
+ | === 500 error === | ||
+ | |||
+ | You may experience a 500 error during installation if: | ||
+ | * The PHP version is less than 7.1 | ||
+ | * PHP module packages are missing | ||
+ | |||
+ | Check your PHP version. If it's lower than PHP 7.1, installation will fail. | ||
+ | |||
+ | If it's PHP 7.1 and above, there may be some missing PHP modules. Check the server error log. | ||
+ | |||
+ | If you see something like this: | ||
+ | |||
+ | <code> | ||
+ | [STDERR] Error: Class 'ZipArchive' not found in /var/www/html/core/lib/Drupal/Core/Archiver/Zip.php on line 30 #0 /var/www/html/core/lib/Drupal/Core/Archiver/ArchiverManager.php(42): Drupal\Core\Archiver\Zip->__construct('/tmp/lscache-dr...') | ||
+ | </code> | ||
- | Install php-pecl-zip package should fix the problem. | + | install the ''php-pecl-zip'' package, and that should fix the problem. |