goaccess教程/中文/更新

debian/ubuntu安装

一般安装方法
apt update
apt install goaccess
跟进官方稳定版本方法
wget -O - https://deb.goaccess.io/gnugpg.key | gpg --dearmor | sudo tee /usr/share/keyrings/goaccess.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/goaccess.gpg arch=$(dpkg --print-architecture)] https://deb.goaccess.io/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/goaccess.list
sudo apt-get update
sudo apt-get install goaccess

修改的配置文件参考

log-format COMBINED
config-dialog false
hl-header true
html-report-title WINOS 网站数据
json-pretty-print false
no-color false
no-column-names false
no-csv-summary false
no-progress false
no-tab-scroll false
with-mouse false
log-file /root/nginx/data/winos.me_access.log
agent-list true
with-output-resolver false
exclude-ip ::ffff:106.*.0.0-::ffff:106.*.255.255
http-method yes
http-protocol yes
output /root/nginx/goaccess/index.html
no-query-string false
no-term-resolver false
444-as-404 false
4xx-to-unique-count false
all-static-files false
double-decode false
ignore-crawlers false
crawlers-only false
ignore-panel REFERRERS
ignore-panel KEYPHRASES
real-os true
static-file .css
static-file .js
static-file .jpg
static-file .png
static-file .gif
static-file .ico
static-file .jpeg
static-file .pdf
static-file .csv
static-file .mpeg
static-file .mpg
static-file .swf
static-file .woff
static-file .woff2
static-file .xls
static-file .xlsx
static-file .doc
static-file .docx
static-file .ppt
static-file .pptx
static-file .txt
static-file .zip
static-file .ogg
static-file .mp3
static-file .mp4
static-file .exe
static-file .iso
static-file .gz
static-file .rar
static-file .svg
static-file .bmp
static-file .tar
static-file .tgz
static-file .tiff
static-file .tif
static-file .ttf
static-file .flv
static-file .dmg
static-file .xz
static-file .zst
geoip-database /root/nginx/maxmind/GeoLite2-City.mmdb

计划任务每分钟运行

crontab -e
加入
*/1 * * * * /root/nginx/goaccess/run.sh

nano /root/nginx/goaccess/run.sh

#!/bin/bash
#页面转换为中文
export LC_ALL=zh_CN.UTF-8
#输出HTML分析报告
sudo find /root/nginx/data -type f -name 'winos*.log' | grep -v 'error' | sudo xargs sudo goaccess

nginx部分配合保护目录

安装生成加密的命令
apt install apache2-utils

新建密码文件
sudo htpasswd -c /root/nginx/.htpasswd 123
新增账号
htpasswd /root/nginx/.htpasswd 456
修改账号密码
htpasswd -p /root/nginx/.htpasswd 456

nginx配置部分
location /goaccess {
    auth_basic "Restricted Access";
    auth_basic_user_file /etc/nginx/.htpasswd;
    alias /etc/nginx/goaccess;
}

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据