nginx-module-vts =============================== .. warning:: 实测官方镜像集成不了这个模块,建议制作独立镜像,从源码构建nginx和添加第三方模块。 https://github.com/nginxinc/docker-nginx/issues/144 https://github.com/vozlt/nginx-module-vts 独立制作nginx镜像,并集成 ``nginx-modulevts`` 模块 .. code-block:: dockerfile FROM ubuntu:20.04 as builder RUN sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list && \ apt-get clean && \ apt-get update && \ apt-get upgrade -y && \ apt-get install -y --no-install-recommends \ make \ wget \ build-essential \ git && \ wget -O nginx.tar.gz http://nginx.org/download/nginx-1.22.1.tar.gz && \ tar zxmf nginx.tar.gz && \ cd nginx*/ && \ git clone https://github.com/vozlt/nginx-module-vts.git && \ ./configure --add-module=nginx-module-vts --without-http_rewrite_module --without-http_gzip_module && \ make && make install # build-essential - C编译依赖 # CMD ["nginx", "-g", "daemon off;"] .. code-block:: text git clone git://github.com/vozlt/nginx-module-vts.git nginx添加模块: ``--add-module=/path/to/nginx-module-vts`` 支持prometheus格式, 修改nginx配置文件 .. code-block:: nginx http { vhost_traffic_status_zone; ... server { ... location /status { vhost_traffic_status_display; vhost_traffic_status_display_format prometheus; } } } 打开 ``127.0.0.1/status``