1. 使用yum 安装
yum install glib2 glib2-devel GeoIP-devel ncurses-devel zlib zlib-develyum install gcc -y
yum -y install GeoIP-update
yum install goaccess
2.修改/etc/nginx/nginx.conf文件的日志存储格式
log_format main '$remote_addr $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '$http_user_agent $http_x_forwarded_for $request_time $upstream_response_time $upstream_addr $upstream_status';
3.测试生成页面
#goaccess -f Nginx access.log目录 -c -a > nginx默认目录
goaccess -f /tmp/nginx/log/access.log -c -a > /tmp/nginx/html/go.html
#后台实时生成数据到goaccess页面
#goaccess -f Nginx access.log目录 -o > nginx默认目录 --real-time-html &
goaccess /tmp/nginx/log/access.log -o /tmp/nginx/html/go.html --real-time-html &
4.访问界面

其他文章:
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/214621.html原文链接:https://javaforall.net
