1. 使用yum安装在不同服务器上可能失败, 推荐使用源码安装goaccess
# 安装依赖 yum install -y ncurses-devel GeoIP-devel.x86_64 tokyocabinet-devel openssl-devel# 下载源码包并安装 cd /usr/local/software wget http://tar.goaccess.io/goaccess-1.3.tar.gz tar -xvf goaccess-1.3.tar.gz -C /usr/local/ cd /usr/local/ ./configure --enable-utf8 --enable-geoip=legacy make & make install# 将goaccess 执行程序关联到系统 find / -name 'goaccess' ln -s /usr/local/goaccess-1.3/goaccess /usr/bin
# 使用goaccess监控
goaccess /var/log/nginx/access.log -o /usr/local/nginx/html/report.html --real-time-html --time-format='%H:%M:%S' --date-format='%d-%b-Y' --log-format=COMBINED
2. 配置nginx.conf, 使用浏览器访问
# goaccess 日志分析server {listen 83;server_name 196.128.1.1;location / {root html;index report.html;}}
3. 浏览器访问
参考:
https://my.oschina.net/mrco/blog/181737
https://yq.aliyun.com/articles/695263