Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
litespeed_wiki:cache:developer_guide:use_cases [2016/09/09 13:36] George Wang |
litespeed_wiki:cache:developer_guide:use_cases [2020/07/31 19:37] (current) Lisa Clarke Redirect to new Documentation Site |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Use cases ====== | + | ~~REDIRECT>https://docs.litespeedtech.com/lscache/devguide/usage/~~ |
- | ===== Cache separate views for desktop/mobile users ===== | + | |
- | Add cache vary based on User-Agent string to save to and serve from the correct cache copy. | + | |
- | + | ||
- | ===== Cache only for guest visitors ===== | + | |
- | Add cache vary for logged in users, but only cache non-logged in users. | + | |
- | + | ||
- | ===== How to enable geolocation for LSCache ===== | + | |
- | [[https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscache:geoip-support]] \\ \\ LSCache supports GEOIP. To enable it, the following steps need to be followed: | + | |
- | - Enable the Geolocation database: \\ In the LSWS Web Console: General →General settings:→ [[https://www.litespeedtech.com/docs/webserver/config/general#enableIpGeo | Enable IP GeoLocation]] → Yes | + | |
- | - Install the GeoIP database (for CentOS users): \\ ''yum install Geoip-data'' \\ or \\ ''yum install GeoIP-GeoLite-data'' \\ \\ Also check the installation location \\ ''rpm -ql Geoip-data'' \\ or \\ ''rpm -ql GeoIP-GeoLite-data'' \\ \\ It may return the database path as: \\ ''/usr/share/GeoIP/GeoIP.dat'' \\ \\ In the LSWS Admin Console, configure the database location: General →General settings:→ [[https://www.litespeedtech.com/docs/webserver/config/general#geolocationDB|IP to GeoLocation DB]] ( enter the database path ). | + | |
- | - Install other modules: \\ ''yum install GeoIP GeoIP-devel zlib-devel'' | + | |
- | - Enable GeoIP on Apache Conf Config the same way you do in Apache, by placing the following directive: \\ ''GeoIPEnable On'' | + | |
- | - Use rewrite rules to control redirects: \\ For example, add the following rewrite rules to your ''.htaccess'' file: \\ <code><IfModule LiteSpeed> | + | |
- | RewriteEngine on | + | |
- | RewriteRule .* - [E=Cache-Control:vary=%{ENV:GEOIP_COUNTRY_CODE}] | + | |
- | </IfModule></code> | + | |
- | + | ||
- | You can add rewrite conditions for more specific rules. For example: Show different content or currencies for UK, EU, US, and the rest of the world. \\ | + | |
- | + | ||
- | You can also refer to this [[http://dev.maxmind.com/geoip/legacy/mod_geoip2/#Redirecting_a_client_based_on_country|Maxmind]] page for rewrite examples. | + |