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
Next revision Both sides next revision
litespeed_wiki:lisa-temp [2018/07/18 14:20]
Lisa Clarke [Step 1. Install]
litespeed_wiki:lisa-temp [2018/07/18 14:23] (current)
Lisa Clarke [Step 5. Check DB by Lookup Command]
Line 18: Line 18:
 /​usr/​local/​share/​GeoIP/​GeoLite2-Country.mmdb /​usr/​local/​share/​GeoIP/​GeoLite2-Country.mmdb
 </​code>​ </​code>​
-Set **DB Name** to: ''​%%COUNTRY_DB%%''​ {{https://​openlitespeed.org/​wp-content/​uploads/​2018/​07/​iptogeo_config-2.jpg?​805x397}} Similarly, add the city database by specifying **DB File Path:** ''​%%/​usr/​local/​share/​GeoIP/​GeoLite2-City.mmdb%%''​ and **DB Name:** to: ''​%%CITY_DB%%''​ Navigate to **Web Admin > Configurations > Your Virtual Hosts > Rewrite** to add rewrite rules that will control the redirect:+Set **DB Name** to: ''​%%COUNTRY_DB%%'' ​ 
 + 
 +{{https://​openlitespeed.org/​wp-content/​uploads/​2018/​07/​iptogeo_config-2.jpg?​805x397}} ​ 
 + 
 +Similarly, add the city database by specifying **DB File Path:** ''​%%/​usr/​local/​share/​GeoIP/​GeoLite2-City.mmdb%%''​ and **DB Name:** to: ''​%%CITY_DB%%'' ​ 
 + 
 +Navigate to **Web Admin > Configurations > Your Virtual Hosts > Rewrite** to add rewrite rules that will control the redirect:
  
 <​code>​ <​code>​
Line 26: Line 32:
 </​IfModule>​ </​IfModule>​
 </​code>​ </​code>​
 +
 Refer to [[http://​dev.maxmind.com/​geoip/​legacy/​mod_geoip2/#​Redirecting_a_client_based_on_country|Maxmind]] for more rewrite examples. Refer to [[http://​dev.maxmind.com/​geoip/​legacy/​mod_geoip2/#​Redirecting_a_client_based_on_country|Maxmind]] for more rewrite examples.
  
Line 34: Line 41:
 == Method 1: == == Method 1: ==
  
-From [[https://​hide.me/​en/​proxy|This site]], we can simply put in a web IP and choose a country from three(USA, Germany, Netherlands). If you want more than three countries, then you need to register for a paid plan. {{https://​openlitespeed.org/​wp-content/​uploads/​2018/​06/​Geo-3.png?​887x381}}+From [[https://​hide.me/​en/​proxy|This site]], we can simply put in a web IP and choose a country from three(USA, Germany, Netherlands). If you want more than three countries, then you need to register for a paid plan.  
 + 
 +{{https://​openlitespeed.org/​wp-content/​uploads/​2018/​06/​Geo-3.png?​887x381}}
  
 == Method 2: == == Method 2: ==
  
-You can choose a free proxy server from online free resources, e.g. [[https://​free-proxy-list.net/​|Free_Proxy]] {{https://​openlitespeed.org/​wp-content/​uploads/​2018/​06/​Geo-1.png?​1011x484}} Setup the proxy IP with your browser. Here are the steps for Chrome:+You can choose a free proxy server from online free resources, e.g. [[https://​free-proxy-list.net/​|Free_Proxy]] ​ 
 +{{https://​openlitespeed.org/​wp-content/​uploads/​2018/​06/​Geo-1.png?​1011x484}} 
 + 
 +Setup the proxy IP with your browser. Here are the steps for Chrome:
  
   - Click on **Settings**.   - Click on **Settings**.
Line 54: Line 66:
 ==== Step 4. Check Correct IP is Set ==== ==== Step 4. Check Correct IP is Set ====
  
-You can check source IP via LiteSpeed default php page ''​%%http://​yourdomain/​index.php?​act=phpinfo%%''​.  Check the ''​%%$_SERVER%%''​ variables, and look for the ones which begin with ''​%%GEOIP_%%''​. {{https://​openlitespeed.org/​wp-content/​uploads/​2018/​07/​geoenv.jpg?​533x235}} The environment variables are based on the default environment definitions.  The advanced section below shows you how to customize them for your environment to allow you to specify environment names, display language, additional databases, etc.+You can check source IP via LiteSpeed default php page ''​%%http://​yourdomain/​index.php?​act=phpinfo%%''​.  Check the ''​%%$_SERVER%%''​ variables, and look for the ones which begin with ''​%%GEOIP_%%''​. ​ 
 + 
 +{{https://​openlitespeed.org/​wp-content/​uploads/​2018/​07/​geoenv.jpg?​533x235}} 
 + 
 +The environment variables are based on the default environment definitions.  The advanced section below shows you how to customize them for your environment to allow you to specify environment names, display language, additional databases, etc.
  
 ==== Step 5. Check DB by Lookup Command ==== ==== Step 5. Check DB by Lookup Command ====
  
-A very useful MaxMind tool is downloaded and compiled with the source code release: ''​%%mmdblookup%%''​.  Use this tool to view an entry in the database for a specific IP. For example, to see the country name definition for the IP address 47.22.54.182 enter from a command prompt in the openlitespeed directory: ''​%%libmaxminddb/​bin/​mmdblookup --file /​usr/​local/​share/​GeoIP/​GeoLite2-Country.mmdb --ip 47.22.54.182 -v%%''​ The output is very detailed and can be informative as it shows you the information available in the database:+A very useful MaxMind tool is downloaded and compiled with the source code release: ''​%%mmdblookup%%''​.  Use this tool to view an entry in the database for a specific IP. For example, to see the country name definition for the IP address 47.22.54.182 enter from a command prompt in the openlitespeed directory: ​ 
 + 
 +''​%%libmaxminddb/​bin/​mmdblookup --file /​usr/​local/​share/​GeoIP/​GeoLite2-Country.mmdb --ip 47.22.54.182 -v%%'' ​ 
 + 
 +The output is very detailed and can be informative as it shows you the information available in the database:
  
 <​code>​ <​code>​
  • Admin
  • Last modified: 2018/07/18 14:20
  • by Lisa Clarke