nginx动态添加nginx-module-vts监控流量
一、进入nginx源码的安装目录
我的目录是:
/data/soft/nginx-1.12.1/src
2.使用git得到nginx-module-vts模块
git clone git://github.com/vozlt/nginx-module-vts.git3.进行配置参数
- 首先查看nginx已经编译的参数,nginx -V
- 进行编译前的参数配置
./configure --prefix=/usr/local/nginx --with-select_module --with-poll_module --with-file-aio --with-http_realip_module --with-http_addition_module --with-http_image_filter_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_secure_link_module --with-http_stub_status_module --with-http_sub_module --without-http_geo_module --with-pcre --http-log-path=/usr/local/nginx/logs/ --http-client-body-temp-path=/usr/local/nginx/temp/client --http-proxy-temp-path=/usr/local/nginx/temp/proxy --http-fastcgi-temp-path=/usr/local/nginx/temp/fastcgi --http-uwsgi-temp-path=/usr/local/nginx/temp/uwsgi --http-scgi-temp-path=/usr/local/nginx/temp/scgi --with-http_perl_module --with-http_ssl_module --add-module=/data/soft/nginx-1.12.1/src/nginx-module-vts4.执行编译(注意:make编译完成后,不要执行make install)
make
5.进入objs查看新生成的nginx,并进行测试,nginx -V
查看编译的配置命令是否一致。
6.复制objs目录下得nginx,到线上的nginx执行文件并覆盖。(覆盖前注意先备份要覆盖的nginx可执行文件)
覆盖nginx文件时,需要停止nginx服务,然后才能进行覆盖。
7.修改nginx.conf文件配置
1.在http项里添加
vhost_traffic_status_zone;
#vhost_traffic_status_filter_by_host on;
include vhost/nginx_module_vts.conf;nginx_module_vts.conf文件内容
server {
listen 1500;
server_name localhost;
access_log /data/logs/nginx/nginx-module-vts.log;
location /status {
vhost_traffic_status_display;
vhost_traffic_status_display_format html;
}
}8.访问nginx试试流量地址
http://IP:1500/status

相关推荐
-
「nginx」十、nginx的location配置详解2026-07-04 00:51:45 -

最清晰的mysql体系架构图 ,助你深度掌握MySQL开发管理,赢在大数据时代
最清晰的mysql体系架构图 ,助你深度掌握MySQL开发管理,赢在大数据时代2026-07-04 00:21:47 -
PHP读取Excel内的图片2026-07-03 00:07:41 -
mysql:Otter跨机房数据同步(单向)2026-07-03 00:02:48 -

在windows10系统下搭建IIS+PHP+MYSQL+phpMyAdmin服务器运行环境
在windows10系统下搭建IIS+PHP+MYSQL+phpMyAdmin服务器运行环境2026-07-02 00:15:08