概要

フル名
docker.io/cnych/nginx-vts
Registry
docker.io
名前空間
cnych
リポジトリ
nginx-vts
キャッシュ Tag 数
1
最終同期
07/06/2026, 07:26 PM

概要

集成 nginx-module-vts 的 Nginx 镜像,在 /status 暴露虚拟主机流量与 upstream 指标,供 Prometheus nginx-vts-exporter 采集。

詳細

cnych/nginx-vts 在官方 Nginx 基础上编译 VTS 模块,实时统计 server/zone/upstream 请求数、字节与响应码分布。需在 nginx.conf 中 vhost_traffic_status_zone 并 location /status 供 exporter scrape。与 stub_status 相比维度更细,适合多虚拟主机反向代理监控;生产应限制 /status 仅内网访问,避免泄露拓扑信息。

快速启动

docker run -d --name nginx-vts \
  -p 80:80 -p 8080:8080 \
  -v $(pwd)/nginx.conf:/etc/nginx/nginx.conf:ro \
  docker.io/cnych/nginx-vts:latest

推荐实践

docker run -d --name nginx-vts \
  --restart unless-stopped \
  -p 80:80 -p 8080:8080 \
  -v /etc/nginx/nginx.conf:/etc/nginx/nginx.conf:ro \
  -v /var/log/nginx:/var/log/nginx \
  docker.io/cnych/nginx-vts:1.25.3

核心参数说明

  • -v .../nginx.conf:ro — 含 vhost_traffic_status 配置
  • -p 80:80 — 业务反向代理端口
  • -p 8080:8080/status VTS 指标端点
  • -v /var/log/nginx:... — 访问日志持久化
  • --restart unless-stopped — 网关持续在线
  • 固定 tag — Nginx 与 VTS 模块版本绑定

Kubernetes

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-vts
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx-vts
  template:
    metadata:
      labels:
        app: nginx-vts
    spec:
      containers:
        - name: nginx
          image: docker.io/cnych/nginx-vts:1.25.3
          ports:
            - containerPort: 80
            - containerPort: 8080
          volumeMounts:
            - name: config
              mountPath: /etc/nginx/nginx.conf
              subPath: nginx.conf
      volumes:
        - name: config
          configMap:
            name: nginx-vts-config
---
apiVersion: v1
kind: Service
metadata:
  name: nginx-vts
spec:
  selector:
    app: nginx-vts
  ports:
    - name: http
      port: 80
      targetPort: 80
    - name: status
      port: 8080
      targetPort: 8080

ConfigMap 注入 nginx.conf;ServiceMonitor scrape 8080,Ingress 仅暴露 80。

Tagアーキテクチャプッシュ日時サイズDigest同期期望操作
docker.io/cnych/nginx-vts
:v1.0
linux/amd64
2020/04/07 14:107.1 MBsha256:c0b82d712b06