Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
litespeed_wiki:cache:no-plugin-prestashop [2017/04/12 21:01] Jackson Zhang [Server Level Settings] |
litespeed_wiki:cache:no-plugin-prestashop [2019/01/23 15:20] Lisa Clarke Redirect to LSCPS Plugin Page |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== LSCache + PrestaShop Configuration ====== | + | ~~REDIRECT>litespeed_wiki:cache:lscps~~ |
- | + | ||
- | 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 with the ability to use rewrite rules to customize cache behavior. | + | |
- | + | ||
- | 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 ===== | + | |
- | + | ||
- | 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. | + | |
- | + | ||
- | ===== Website Level Settings ===== | + | |
- | + | ||
- | At the top of your .htaccess file, located in the document root of your PrestaShop installation, add the following: | + | |
- | + | ||
- | ########## Begin - Litespeed cache | + | |
- | <IfModule LiteSpeed> | + | |
- | CacheLookup public on | + | |
- | RewriteEngine On | + | |
- | RewriteCond %{REQUEST_METHOD} ^GET|HEAD|PURGE$ | + | |
- | RewriteCond %{HTTP_HOST} ^your_domain_name.com [NC] | + | |
- | RewriteCond %{REQUEST_URI} !admin_folder|404|address|authentication|best-sales|cart|contact|discount|guest-tracking|history|identity|order|password|products-comparison|search|account|friend|login|logout|addresses|contact-us|order-history|my-account|order-confirmation|order-follow|quick-order|credit-slip|password-recovery [NC] | + | |
- | RewriteCond %{HTTP_COOKIE} !logged|cart [NC] | + | |
- | RewriteCond %{QUERY_STRING} !nocache [NC] | + | |
- | RewriteRule .* - [E=Cache-Control:max-age=900] | + | |
- | </IfModule> | + | |
- | ########## End - Litespeed cache | + | |
- | + | ||
- | Where "your_domain_name.com" is the web address of your PrestaShop site and "admin_folder" is the PrestaShop administration folder name specified during installation. | + | |
- | + | ||
- | **Note:** 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.) | + | |
- | + | ||
- | We recommend using a different domain for your backend 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 | + | |
- | + | ||
- | https://www.your_domain_name.com/about?nocache | + | |
- | https://www.your_domain_name.com/about?some_other_query_string&nocache | + | |
- | + | ||
- | ===== Discussion ===== | + | |
- | __**Adding a cron job to delete outdated cache files**__ | + | |
- | + | ||
- | While optional, it is a good idea to clear out old cache files that are past the set **Time To Live (TTL)**. To do this enter the following in /etc/crontab | + | |
- | + | ||
- | /10 * * * * root find /tmp/diskcache -type f -mmin +8 -delete 2>/dev/null | + | |
- | + | ||
- | **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 that are way passed TTL. | + |