nginx 安装
下载nginx 源码
wget http://nginx.org/download/nginx-1.16.1.tar.gz
下载vts 模块
git clone git://github.com/vozlt/nginx-module-vts.git
ubuntu 安装ssl 依赖
sudo apt-get install libssl-dev
强制升级依赖
sudo apt-get -f install
./configure: error: the HTTP rewrite module requires the PCRE library.
解决
sudo apt-get install libpcre3 libpcre3-dev
配置
./configure --prefix=/opt/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --add-module=../nginx-module-vts --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_stub_status_module --with-http_v2_module
编译 安装
make install
测试配置是否正常
/opt/nginx/sbin/nginx -t
备份旧版本
cp /usr/sbin/nginx /opt/nginx/nginx20200113.bak
停止
nginx -s stop
替换成新版本
rm -f /usr/sbin/nginx
ln -s /opt/nginx/sbin/nginx /usr/sbin/nginx
检查 新版本
nginx -v
nginx -t
nginx -s reload
配置 vts
http {
vhost_traffic_status_zone;
server {
allow 192.168.1.73;
allow 127.0.0.1;
deny all;
listen 1777;
charset utf-8;
location /status {
vhost_traffic_status_display;
vhost_traffic_status_display_format html;
}
}
}