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 Both sides next revision
litespeed_wiki:cache:common:geoip-support [2019/04/16 20:25]
Jackson Zhang
litespeed_wiki:cache:common:geoip-support [2019/04/17 14:52]
Lisa Clarke [Advanced Configuration:GEOIP2 Envirment Variables] Copyediting
Line 46: Line 46:
   </​code>​   </​code>​
  
-==== Advanced Configuration:​GEOIP2 ​Envirment ​Variables ====+==== Advanced Configuration:​GEOIP2 ​Environment ​Variables ====
  
-The full power of the GeoIP2 ​facility ​requires use of the environment variables in the Litespeed Configuration The description of the format used is designed to be as similar as possible ​as the Apache mod_maxminddb environment described [[https://​github.com/​maxmind/​mod_maxminddb|here]] specifically for the MaxMindDBEnv variable. ​ Each environment variable is specified in the environment text box as one line:+The full power of GeoIP2 requires ​the use of environment variables in the LiteSpeed configuration. The format used is designed to be as similar as possible ​to the Apache ​''​mod_maxminddb'' ​environment described [[https://​github.com/​maxmind/​mod_maxminddb|here]] ​,specifically for the ''​MaxMindDBEnv'' ​variable. ​ Each environment variable is specified in the environment text box as one line:
  
   * The name of the environment variable that will be exported, for example ''​GEOIP_COUNTRY_NAME''​   * The name of the environment variable that will be exported, for example ''​GEOIP_COUNTRY_NAME''​
   * A space   * A space
-  * The logical name of the environment variable.  That consists of: +  * The logical name of the environment variable, which consists of: 
-    * It uses the name of the database as specified in the DB Name field as the prefix. ​ For example COUNTRY_DB +    * The name of the database as specified in the **DB Name** field as the prefix. For example, ''​COUNTRY_DB''​ 
-    * A forward slash / +    * A forward slash ''​/''​ 
-    * The forward slash separated ​name of the field as displayed in ''​mmdblookup''​. ​ For example: ''​country/​names/​en''​+    * The name of the field as displayed in ''​mmdblookup''​. ​ For example: ''​country/​names/​en''​
  
 Thus the default generates: Thus the default generates:
Line 65: Line 65:
   GEOIP_COUNTRY_NAME COUNTRY_DB/​country/​names/​es   GEOIP_COUNTRY_NAME COUNTRY_DB/​country/​names/​es
  
-Note that if a variable is used by multiple databases (for example, the default ''​GEOIP_COUNTRY_NAME''​) you need to override the value in the last database specified (or all databases in case they get reordered, just to be safe).+Note that if a variable is used by multiple databases (for example, the default ''​GEOIP_COUNTRY_NAME''​)you need to override the value in the last database specified (or all databases in case they get reordered, just to be safe).
  
 Note that ''​subdivisions''​ is an array and must be referenced by index (usually ''​0''​ or ''​1''​). Note that ''​subdivisions''​ is an array and must be referenced by index (usually ''​0''​ or ''​1''​).
Line 81: Line 81:
   "​GEOIP_POSTAL_CODE",​ "/​postal/​code"​   "​GEOIP_POSTAL_CODE",​ "/​postal/​code"​
   "​GEOIP_CITY",​ "/​city/​names/​en"​   "​GEOIP_CITY",​ "/​city/​names/​en"​
- 
  
 You can customize the configuration to add the environment variables you want as describe above. ​ You can customize the configuration to add the environment variables you want as describe above. ​
  
-=== Example 1Make sure the entry name correct ​===+=== Example 1 === 
 +Make sure the entry name is correct.
  
-you can add the following+You can add the following
   GEOIP_REGION_NAME CITY_DB/​subdivisions/​0/​names/​en   GEOIP_REGION_NAME CITY_DB/​subdivisions/​0/​names/​en
 Please make sure the correct entry name is used. For example, the following is incorrect. ​ Please make sure the correct entry name is used. For example, the following is incorrect. ​
Line 93: Line 93:
  
 === Example 2 ===  === Example 2 === 
-You can customize a name as "MyTest_COUNTRY_CODE" as the following:+You can customize a name as ''​MyTest_COUNTRY_CODE'',​ like so:
   MyTest_COUNTRY_CODE CITY_DB/​country/​iso_code   MyTest_COUNTRY_CODE CITY_DB/​country/​iso_code
   ​   ​
 {{ :​litespeed_wiki:​cache:​common:​litespeed-geoip2-variables-e1.png?​800 |}} {{ :​litespeed_wiki:​cache:​common:​litespeed-geoip2-variables-e1.png?​800 |}}
  
-It will show from phpinfo.php page as:+It will show on the ''​phpinfo.php'' ​page as:
    ​_SERVER["​MyTest_COUNTRY_CODE"​] ​ US    ​_SERVER["​MyTest_COUNTRY_CODE"​] ​ US
-"US" ​will be replaced by your country code visiting from, such "SG" ​or others.+''​US'' ​will be replaced by the country code you are visiting from, such as ''​SG'' ​or others.
  
 === Example 3 === === Example 3 ===
-You can customize a name as "MyTest2_COUNTRY_CODE" ​by using a defined COUNTRY DB name "COUNTRY_DB_20190402" ​with a contry ​database.+You can customize a name as ''​MyTest2_COUNTRY_CODE'' ​by using a defined COUNTRY DB name ''​COUNTRY_DB_20190402'' ​with a country ​database.
   MyTest2_COUNTRY_CODE COUNTRY_DB_20190402/​country/​iso_code   MyTest2_COUNTRY_CODE COUNTRY_DB_20190402/​country/​iso_code
 {{ :​litespeed_wiki:​cache:​common:​litespeed-geoip2-variables-e2.png?​800 |}}  ​ {{ :​litespeed_wiki:​cache:​common:​litespeed-geoip2-variables-e2.png?​800 |}}  ​
-It will show from phpinfo.php page as:+It will show on the ''​phpinfo.php'' ​page as:
   _SERVER["​MyTest2_COUNTRY_CODE"​] US   _SERVER["​MyTest2_COUNTRY_CODE"​] US
  
 === Example 4 === === Example 4 ===
  
-You can customize ​like the following:+You can customize ​all of the following:
   HTTP_GEOIP_CITY CITY_DB/​city/​names/​en   HTTP_GEOIP_CITY CITY_DB/​city/​names/​en
   HTTP_GEOIP_POSTAL_CODE CITY_DB/​postal/​code   HTTP_GEOIP_POSTAL_CODE CITY_DB/​postal/​code
Line 123: Line 123:
 {{ :​litespeed_wiki:​cache:​common:​litespeed-geoip2-variables-e4-1.png?​600 |}} {{ :​litespeed_wiki:​cache:​common:​litespeed-geoip2-variables-e4-1.png?​600 |}}
  
-The following ​will show in phpinfo.php page:+It will show on the ''​phpinfo.php'' ​page as:
   _SERVER["​HTTP_GEOIP_CITY"​] Montville   _SERVER["​HTTP_GEOIP_CITY"​] Montville
   _SERVER["​HTTP_GEOIP_POSTAL_CODE"​] 07045   _SERVER["​HTTP_GEOIP_POSTAL_CODE"​] 07045
  • Admin
  • Last modified: 2020/11/14 15:24
  • by Lisa Clarke