geoIp在Nginx日志文件中未显示国家名称

问题描述

我正在尝试使用国家名称创建Nginx日志文件。我从this链接获得了帮助。但不是国家名称,而是在日志文件中存储“-”。

我的日志:

103.102.43.25 - - [02/Nov/2020:07:10:29 +0000]  "GET /legislation/act-api/?value=act_title HTTP/1.1" 200 176219 value=act_title"https://www.legislib.com/case/case-details/5ac2f15276ab0b654f3c5a89/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,like Gecko) Chrome/86.0.4240.111 Safari/537.36""-" "-"

我的Nginx配置:

user www-data;
worker_processes auto;
pid /run/Nginx.pid;
include /etc/Nginx/modules-enabled/*.conf;

events {
    worker_connections 768;
}

http {

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;

    include /etc/Nginx/mime.types;
    default_type application/octet-stream;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3,ref: POODLE
    ssl_prefer_server_ciphers on;

    geoip_city /etc/Nginx/geoip/geoCity;
    geoip_country /etc/Nginx/geoip/geoCountry;

    log_format analytics '$remote_addr - $upstream_cache_status [$time_local]  '
                    '"$request" $status $body_bytes_sent $query_string'
                    '"$http_referer" "$http_user_agent"'
                    '"$geoip_country_name" "$geoip_country_code"';

    access_log /var/log/Nginx/access.log analytics;
    error_log /var/log/Nginx/error.log;

    gzip on;

    include /etc/Nginx/conf.d/*.conf;
    include /etc/Nginx/sites-enabled/*;
}

有人知道出什么问题吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)