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:lscache:geoip-support [2016/03/23 19:58] Michael Alegre removed |
litespeed_wiki:cache:lscache:geoip-support [2022/04/20 19:07] (current) Lisa Clarke |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== How to enable geolocation for LSCache ===== | + | ~~REDIRECT>https://docs.litespeedtech.com/lsws/cp/cpanel/geoip/#use-geoip-for-cache-varies~~ |
- | + | ||
- | LSCache supports GEOIP. To enable it, the following steps need to be followed. | + | |
- | + | ||
- | 1. Enable Geolocation database | + | |
- | + | ||
- | From LSWS Web Console: General ->General settings:-> [[https://www.litespeedtech.com/docs/webserver/config/general#enableIpGeo|Enable IP GeoLocation]] -> Yes | + | |
- | + | ||
- | + | ||
- | 2. Install GeoIP database | + | |
- | For CentOS user: | + | |
- | 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 database path as: | + | |
- | /usr/share/GeoIP/GeoIP.dat | + | |
- | + | ||
- | In 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 ). | + | |
- | + | ||
- | 3. Install other modules: | + | |
- | yum install GeoIP GeoIP-devel zlib-devel | + | |
- | + | ||
- | 4. Enable GeoIP on Apache Conf Config by placing the the following directive as the same way as apache. | + | |
- | GeoIPEnable On | + | |
- | 5. User rewrite rule to control the redirect: | + | |
- | + | ||
- | For example, add the following rewrite rules to your “.htaccess” file: | + | |
- | + | ||
- | <IfModule LiteSpeed> | + | |
- | RewriteEngine on | + | |
- | RewriteRule .* - [E=Cache-Control:vary=%{ENV:GEO_COUNTRY}] | + | |
- | </IfModule> | + | |
- | + | ||
- | You can add rewrite condition for more specific rules, such as UK, EU and US + rest of the world show different contents, or show different currencies. | + | |
- | + | ||
- | You can also refer to [[http://dev.maxmind.com/geoip/legacy/mod_geoip2/#Redirecting_a_client_based_on_country|Maxmind]] page for rewrite examples. | + |