GoatCounter

来自wrc's Wiki
Weirane讨论 | 贡献2021年4月18日 (日) 02:13的版本 (建立内容为“GoatCounter 是一个 Google Analytics 的替代品。[https://github.com/zgoat/goatcounter GitHub] == Nginx 配置 == <syntaxhighlight lang=nginx> server {…”的新页面)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳到导航 跳到搜索

GoatCounter 是一个 Google Analytics 的替代品。GitHub

Nginx 配置

server {
    server_name stats.example.com;

    location / {
        proxy_pass http://127.0.0.1:8081;
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Connection "";
        proxy_http_version 1.1;
    }
}

Systemd 配置

先写一个启动脚本

#!/bin/sh
set -e
cd "$(dirname "$(realpath "$0")")"
exec ./goatcounter serve -listen 127.0.0.1:8081 -tls=http -automigrate

Systemd unit:

# ~/.config/systemd/user/goatcounter.service
[Unit]
Description=GoatCounter

[Service]
WorkingDirectory=/srv/goatcounter
ExecStart=/srv/goatcounter/start.sh

[Install]
WantedBy=default.target

启动

systemctl --user enable --now goatcounter.service