Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
litespeed_wiki:cache:no-plugin-prestashop [2017/05/05 20:45]
Jackson Zhang [Discussion]
litespeed_wiki:cache:no-plugin-prestashop [2017/08/14 19:47]
Lisa Clarke Added note to indicate this page has been deprecated
Line 1: Line 1:
 ====== LSCache + PrestaShop Configuration ====== ====== LSCache + PrestaShop Configuration ======
  
-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 PrestaShop, you can expect significant performance gains with a quick and easy setup. Cache management is also made significantly easier and more flexible. While the LiteSpeed cache plugin for Prestashop is still in development,​ rewrite rules can still be used to customize LSCache'​s behavior.+**Note: This page describes an easy way to set up simple caching for PrestaShop installations. With the release of LiteSpeed Cache for PrestaShop, though, this solution is now deprecated. [[litespeed_wiki:​cache:​lscps|Click here]] for the LiteSpeed Cache for PrestaShop 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 PrestaShop, you can expect significant performance gains with a quick and easy setup. Cache management is also made significantly easier and more flexible. While the LiteSpeed cache plugin for Prestashop is still in development,​ rewrite rules can be used to customize LSCache'​s behavior.
  
 Below are some recommended configurations to enable LSCache and get it working with your PrestaShop site(s). Below are some recommended configurations to enable LSCache and get it working with your PrestaShop site(s).
  
  
-===== Configure Server/​Virtual Host Level Cache Root And Cache Policy =====+===== Configure Server/​Virtual-Host-Level Cache Root And Cache Policy =====
  
-Server/VirtualHost ​level cache storage needs to be configured properly for your environment. Select your server setup from the **Web Server Configuration** section of our **[[litespeed_wiki:​cache:​common_installation#​web_server_configuration|LiteSpeed Cache Installation Guide]]** and follow the instructions to set the server/​virtual host level cache root and cache policy.+Server/Virtual-Host-level cache storage needs to be configured properly for your environment. Select your server setup from the **Web Server Configuration** section of our [[litespeed_wiki:​cache:​common_installation#​web_server_configuration|LiteSpeed Cache Installation Guide]] and follow the instructions to set the server/​virtual-host-level cache root and cache policy.
  
 ===== Rewrite Rules ===== ===== Rewrite Rules =====
  
-At the top of your .htaccess file, located in the document root of your PrestaShop installation,​ add the following:+At the top of your ''​.htaccess'' ​file, located in the document root of your PrestaShop installation,​ add the following:
  
   ########## Begin - Litespeed cache   ########## Begin - Litespeed cache
Line 27: Line 29:
   ########## End - Litespeed cache   ########## End - Litespeed cache
   ​   ​
-**Note1:​** ​ The **"​CacheDisable public /"** directive is used to help protect against globally enabled caching and is optional. Instead, the server'​s global cache settings should be checked to ensure that cache is not enabled globally. **Do NOT** use **"​CacheEnable public /"** here as it will enable caching for all URLs belonging to this virtual host, including admin pages. +====Notes====
-   +
-**Note2:** Where "​your_domain_name.com"​ is the web address of your PrestaShop site and "​your_admin_folder"​ is the PrestaShop administration folder name specified during installation. Replace them with your real domain name and admin folder. +
- +
-**Note3:** For any friendly URLs included in the REQUEST_URI configuration line, make sure any corresponding translated (rewritten) URLs are also included. (To view friendly URLs in the PrestaShop administration interface, click Preferences >> SEO & URLs.) +
- +
-**Note4:** We recommend using a different domain for your backend such as backend.your_domain_name.com so that you can add/​edit/​preview a website'​s content through the admin domain without worrying about these changes being cached and seen by visitors.+
  
-**Note5:** To get the non-cached version of a page, add the "nocache" ​query string to a URL.+  ​The ''​CacheDisable public /''​ directive is used to help protect against globally-enabled caching and is optional. If this directive is not used, the server'​s global cache settings should be checked to ensure that cache is not enabled globally. ​**Do NOT** use ''​CacheEnable public /''​ here as it will enable caching for all URLs belonging to this virtual host, including admin pages. 
 +  * ''​your_domain_name.com''​ is the web address of your PrestaShop site and ''​your_admin_folder''​ is the PrestaShop administration folder name specified during installation. Replace them with your real domain name and admin folder. 
 +  * For any friendly URLs included in the ''​REQUEST_URI''​ configuration line, make sure any corresponding translated (rewritten) URLs are also included. (To view friendly URLs in the PrestaShop administration interface, navigate to **Preferences > SEO & URLs**.) 
 +  * We recommend using a different domain for your backend such as backend.your_domain_name.com so that you can add/​edit/​preview a website'​s content through the admin domain without worrying about these changes being cached and seen by visitors. 
 +  ​* To get the non-cached version of a page, add the ''​nocache'' ​query string to a URL.
  
 For example For example
Line 44: Line 44:
 ===== Verify Cache Setup ===== ===== Verify Cache Setup =====
  
-Open your browsers inspector, by right-clicking and selecting "​Inspector"​ or pressing the F12 key, and refresh the page. Under the "​Network"​ tab look for the HTML page you just loaded and clikc on it to view it's response header.  +Look for ''​X-LiteSpeed-Cache:​ hit'' ​in the reply headers. [[litespeed_wiki:​cache:no-plugin-setup-guidline#​verify_that_pages_are_served_from_the_cache|See more detailed directions here]].
- +
-In the response header you should see ''​X-LiteSpeed-Cache:​ hit'' ​to indicate that the page was served from cache successfully. If you see ''​X-LiteSpeed-Cache: miss'',​ reload the page and check again+
  
 ===== Deleting Outdated Cache Files Using A Cron Job ===== ===== Deleting Outdated Cache Files Using A Cron Job =====
  
-**Note:** LSWS will now delete expired ​cache files automatically,​ making ​this step optional. A cron job can still be set up to help ensure that the cache works as expected, clearing out pages that may have been misconfigured ​to have a very long TTL. +Please refer to [[litespeed_wiki:cache:​no-plugin-setup-guidline#​deleting_outdated_cache_files_using_a_cron_job|this wiki]] ​to learn how to clean up outdated ​cache files.
- +
-A cron job should be set to clear out old cache files that are past the set **Time To Live (TTL)**.  +
- +
-To do this, you should run the crontab either as the root user or as the cache owner for self management. +
- +
-<​code>​crontab -e</​code>​ +
- +
-The virtual host cache root directory is normally located in **/​home/​$USER/​lscache** for shared hosting users or **/​tmp/​diskspace** for dedicated servers. +
- +
-<​code>​*/​10 * * * * root find /​virtualhost/​cache/​root/​directory/​ -type f -mmin +8 -delete 2>/​dev/​null</​code>​ +
- +
-**Note:** This cron job deletes cached files that are more than 8 minutes old every 10 minutes. Since the cache TTL is set at 120 seconds (2 minutes), it is safe to delete these files as they are way past their TTL.+
  • Admin
  • Last modified: 2019/01/23 15:20
  • by Lisa Clarke