在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:leev/ngx_http_geoip2_module开源软件地址:https://github.com/leev/ngx_http_geoip2_module开源编程语言:C 100.0%开源软件介绍:Descriptionngx_http_geoip2_module - creates variables with values from the maxmind geoip2 databases based on the client IP (default) or from a specific variable (supports both IPv4 and IPv6) The module now supports nginx streams and can be used in the same way the http module can be used. InstallingFirst install libmaxminddb as described in its README.md file. Download nginx source
To build as a dynamic module (nginx 1.9.11+):
This will produce Add the following line to your nginx.conf:
To build as a static module:
If you need stream support, make sure to compile with stream:
Download Maxmind GeoLite2 Database (optional)The free GeoLite2 databases are available from Maxminds website (requires signing up) Example Usage:
Metadata:Retrieve metadata regarding the geoip database.
Available fields:
Autoreload (default: disabled):Enabling auto reload will have nginx check the modification time of the database at the specified interval and reload it if it has changed.
GeoIP:
If default is not specified, the variable will be empty if not found. If source is not specified, $remote_addr will be used to perform the lookup. To find the path of the data you want (eg: country names en), use the mmdblookup tool:
This translates to:
Additional Commands:These commands works the same as the original ngx_http_geoip_module documented here: http://nginx.org/en/docs/http/ngx_http_geoip_module.html#geoip_proxy. However, if you provide the
Defines trusted addresses. When a request comes from a trusted address, an address from the "X-Forwarded-For" request header field will be used instead.
If recursive search is disabled then instead of the original client address that matches one of the trusted addresses, the last address sent in "X-Forwarded-For" will be used. If recursive search is enabled then instead of the original client address that matches one of the trusted addresses, the last non-trusted address sent in "X-Forwarded-For" will be used. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论