This tutorial explains how to install/configure/enable GeoIP location feature on litespeed web server.
Note: You can only use this feature with enterprise license of litespeed web server.
Follow these steps to get it enabled:
First of all download GeoIP location database from official web site (maxmind):
Login to your server via SSH with root access, and execute following commands: wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz gunzip GeoLiteCity.dat.gz cp GeoLiteCity.dat /usr/local/share/GeoIP/
Now you have downloaded GeoIP location database, next is to enable it from LiteSpeed control panel.
Follow these steps:
liteSpeed admin console->Server->General ->Enable IP GeoLocation: Yes liteSpeed admin console->Server->General ->IP to GeoLocation DB: Add DB File Path: /usr/local/share/GeoIP/GeoIPCity.dat DB Cache Type: MemoryCache
Last step is to add a line in .htaccess file of your hosting account directory (public_html in cPanel)
GeoIPEnable On
Well you have configured/enabled GeoIP location system.
Now just make a test on it:
Create a php file on your hosting account, and paste below code in it:
$countryName = $_SERVER["GEOIP_COUNTRY_NAME"]; $countryCode = $_SERVER["GEOIP_COUNTRY_CODE"]; echo $countryName.'
'.$countryCode; ?>
Now run this file from browser it should return your country name and country code.