【问题标题】:How can i access the GeoLite database in nginx?如何在 nginx 中访问 GeoLite 数据库?
【发布时间】:2021-10-08 01:49:53
【问题描述】:

我运行 Nginx 代理并想使用 GeoLite2-Country/city 数据库。 我按照说明 “https://docs.nginx.com/nginx/admin-guide/dynamic-modules/geoip2/” 和“https://github.com/leev/ngx_http_geoip2_module”。 所以我有所需的 Nginx 模块。我还安装了 Libmaxminddb。

当我想构建我的 Docker-File 时,我收到了这个错误:

"MMDB_open("/geoip/GeoLite2-City.mmdb") 失败 - 打开 在 /etc/nginx/nginx.conf:17 中指定 MaxMind DB 文件

在命令窗口中,我可以通过以下方式访问 Mmdb

      $ mmdblookup --file /etc/nginx/geoip/GeoIP/GeoIP2-Country.mmdb --ip 8.8.8.8

来源:“https://github.com/leev/ngx_http_geoip2_module”

所以该文件应该是可访问的..(路径不同,因为 nginx.conf 路径从 etc/nginx 开始。

也许有人知道我可以尝试或遇到同样的问题?

谢谢你,来自地球的问候!

更新: 我正在使用“Alpine 3.13.5”&&“Nginx-1.21.0”

【问题讨论】:

    标签: docker nginx geoip geoip2 geolite2


    【解决方案1】:

    Nginx.conf 中的路径必须是完整路径!否则不是加载的模块。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-07-13
      • 2010-09-10
      • 2020-07-22
      • 1970-01-01
      • 2023-03-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多