“GoatCounter”的版本间的差异

来自wrc's Wiki
跳到导航 跳到搜索
(建立内容为“GoatCounter 是一个 Google Analytics 的替代品。[https://github.com/zgoat/goatcounter GitHub] == Nginx 配置 == <syntaxhighlight lang=nginx> server {…”的新页面)
 
 
第46行: 第46行:
  
 
  systemctl --user enable --now goatcounter.service
 
  systemctl --user enable --now goatcounter.service
 +
 +
== Adblock ==
 +
 +
在 Adblock 中加入 <code><nowiki>https://stats.example.com/count.js</nowiki></code> 以避免自己的访问被记录。
  
 
[[Category:Server]]
 
[[Category:Server]]

2021年4月19日 (一) 00:52的最新版本

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

Adblock

在 Adblock 中加入 https://stats.example.com/count.js 以避免自己的访问被记录。