博客
关于我
nginx日志不支持中文
阅读量:796 次
发布时间:2023-02-15

本文共 4147 字,大约阅读时间需要 13 分钟。

原创作品,允许转载,转载时请务必以超链接形式标明文章   、作者信息和本声明。否则将追究法律责任。

今天遇到一个奇怪的问题,nginx的access日志不支持中文,其中我的环境变量是支持中文的:

最后的解决办法把nginx的版本降低(原先是1.2.1现在是1.0.5)

未将版本前的日志:

119.14.15.78 - - [06/Dec/2012:20:40:58 +0800] "GET /wide/task/manage HTTP/1.1" 200 2186 "http://apns.ios.ijinshan.com/wide/index" "Mozilla/5.0 (Windows NT 6.1; rv:16.0) Gecko/20100101 Firefox/16.0"

219.143.15.78 - - [06/Dec/2012:20:42:21 +0800] "POST /rpc/report/device HTTP/1.1" 200 42 "-" "\xE9\x87\x91\xE5\xB1\xB1\xE7\x94\xB5\xE6\xB1\xA0\xE5\x8C\xBB\xE7\x94\x9F 3.0.9640.277 (iPhone; iPhone OS 6.0.1; zh_CN)"
219.143.15.78 - - [06/Dec/2012:20:45:17 +0800] "POST /rpc/report/device HTTP/1.1" 200 42 "-" "\xE9\x87\x91\xE5\xB1\xB1\xE7\x94\xB5\xE6\xB1\xA0\xE5\x8C\xBB\xE7\x94\x9F 3.0.9640.277 (iPhone; iPhone OS 6.0.1; zh_CN)"
219.143.15.78 - - [06/Dec/2012:21:00:32 +0800] "POST /rpc/report/device HTTP/1.1" 200 42 "-" "\xE9\x87\x91\xE5\xB1\xB1\xE7\x94\xB5\xE6\xB1\xA0\xE5\x8C\xBB\xE7\x94\x9F 3.0.9640.277 (iPhone; iPhone OS 6.0.1; zh_CN)"
219.143.15.78 - - [06/Dec/2012:21:09:35 +0800] "POST /rpc/report/device HTTP/1.1" 200 42 "-" "\xE9\x87\x91\xE5\xB1\xB1\xE7\x94\xB5\xE6\xB1\xA0\xE5\x8C\xBB\xE7\x94\x9F 3.0.9640.277 (iPhone; iPhone OS 6.0.1; zh_CN)"
219.143.15.78 - - [06/Dec/2012:21:17:43 +0800] "POST /rpc/report/device HTTP/1.1" 200 42 "-" "\xE9\x87\x91\xE5\xB1\xB1\xE7\x94\xB5\xE6\xB1\xA0\xE5\x8C\xBB\xE7\x94\x9F 3.0.9640.277 (iPhone; iPhone OS 6.0.1; zh_CN)"
219.143.15.78 - - [06/Dec/2012:21:18:05 +0800] "POST /rpc/report/device HTTP/1.1" 200 42 "-" "\xE9\x87\x91\xE5\xB1\xB1\xE7\x94\xB5\xE6\xB1\xA0\xE5\x8C\xBB\xE7\x94\x9F 3.0.9640.277 (iPhone; iPhone OS 6.0.1; zh_CN)"
219.143.15.78 - - [06/Dec/2012:21:21:49 +0800] "POST /rpc/report/device HTTP/1.1" 200 42 "-" "\xE9\x87\x91\xE5\xB1\xB1\xE8\xA3\x85\xE6\x9C\xBA\xE5\xBF\x85\xE5\xA4\x87 2.4.7547.19 (iPhone; iPhone OS 6.0.1; zh_CN)"
219.143.15.78 - - [06/Dec/2012:21:37:33 +0800] "POST /rpc/report/device HTTP/1.1" 200 42 "-" "\xE9\x87\x91\xE5\xB1\xB1\xE7\x94\xB5\xE6\xB1\xA0\xE5\x8C\xBB\xE7\x94\x9F 3.0.9640.277 (iPhone; iPhone OS 6.0.1; zh_CN)"

降低版本后的日志:
7.136.24.221 - - [07/Dec/2012:16:07:57 +0800] "POST /rpc/report/device HTTP/1.1" 200 42 "-" "金山电池医生 3.4.8238.321 (iPhone; iPhone OS 5.1.1; zh_CN)"
27.188.236.140 - - [07/Dec/2012:16:07:57 +0800] "POST /rpc/report/device HTTP/1.1" 200 42 "-" "金山电池医生 3.5.9137.322 (iPhone; iPhone OS 5.1.1; zh_CN)"
112.224.65.229 - - [07/Dec/2012:16:07:57 +0800] "POST /rpc/report/device HTTP/1.1" 200 42 "-" "金山电池医生 3.5.9137.322 (iPhone; iPhone OS 6.0.1; zh_CN)"
117.143.123.171 - - [07/Dec/2012:16:07:57 +0800] "POST /rpc/report/device HTTP/1.1" 200 42 "-" "金山电池医生 3.5.9137.322 (iPhone; iPhone OS 6.0.1; zh_CN)"
117.82.182.2 - - [07/Dec/2012:16:07:57 +0800] "POST /rpc/report/device HTTP/1.1" 200 42 "-" "金山电池医生 3.5.9137.322 (iPhone; iPhone OS 6.0; zh_CN)"
27.52.68.198 - - [07/Dec/2012:16:07:57 +0800] "POST /rpc/report/device HTTP/1.1" 200 42 "-" "金山保險箱 1.7.7205.175 (iPhone; iPhone OS 6.0.1; zh_TW)"
221.9.247.34 - - [07/Dec/2012:16:07:57 +0800] "POST /rpc/report/device HTTP/1.1" 200 42 "-" "金山电池医生 3.5.9137.322 (iPhone; iPhone OS 6.0.1; zh_CN)"
61.148.244.97 - - [07/Dec/2012:16:07:57 +0800] "POST /rpc/report/device HTTP/1.1" 200 42 "-" "金山电池医生 3.5.9137.322 (iPhone; iPhone OS 5.1.1; zh_CN)"
90.148.22.7 - - [07/Dec/2012:16:07:57 +0800] "POST /rpc/report/device HTTP/1.1" 200 42 "-" "BatteryDoctor 3.2.7105.315 (iPod touch; iPhone OS 5.0.1; en_US)"
119.39.248.61 - - [07/Dec/2012:16:07:58 +0800] "POST /rpc/report/device HTTP/1.1" 200 42 "-" "金山電池醫生 3.2.7105.315 (iPhone; iPhone OS 5.1.1; zh_CN)"
211.137.59.42 - - [07/Dec/2012:16:07:58 +0800] "POST /rpc/report/device HTTP/1.1" 200 42 "-" "金山电池医生 3.4.8238.321 (iPhone; iPho
具体步骤:
     wget   ##下载nginx的源码包
    tar xzf nginx-1.0.5.tar.gz  ##解压
   cd nginx-1.0.5 ##进入nginx目录
   /usr/local/nginx/sbin/nginx -V  ##查看nginx的编译参数
   ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-openssl=/usr/local/openssl(此参数是上面查到的)
   make && make install(安装)
   ll -tr /usr/local/nginx/sbin/nginx* ##你看到有nginx和nginx.old
   ps -ef | grep nginx  ##查看当前的nginx的master的进程号
   kill -USR2 25518  ##从容切换到新的nginx
   tail /data/logs/apns.ijinshan.com.log ##查看是否支持中文

本文出自 “” 博客,请务必保留此出处

你可能感兴趣的文章
nginx工作笔记004---配置https_ssl证书_视频服务器接口等
查看>>
nginx工作笔记005---nginx配置负载均衡_在微服务中实现网关集群_实现TCP传输层协议__http协议的负载均衡
查看>>
nginx常用命令及简单配置
查看>>
Nginx常用屏蔽规则,让网站更安全
查看>>
Nginx常见问题
查看>>
nginx平滑升级解决 nginx 安全漏洞(CVE-2021-23017)和NGINX 环境问题漏洞(CVE-2019-20372)
查看>>
Nginx平滑添加模块
查看>>
Nginx开启gzip网页传输压缩配置
查看>>
nginx开机启动脚本
查看>>
nginx异常:the “ssl“ parameter requires ngx_http_ssl_module in /usr/local/nginx/conf
查看>>
nginx总结及使用Docker创建nginx教程
查看>>
nginx报错:the “ssl“ parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.conf:128
查看>>
nginx报错:the “ssl“ parameter requires ngx_http_ssl_module in usrlocalnginxconfnginx.conf128
查看>>
Nginx搭建RTMP服务器+FFmpeg实现海康威视摄像头预览
查看>>
Nginx搭建静态资源映射实现远程访问服务器上的图片资源
查看>>
nginx日志不支持中文
查看>>