```sh 下载源码 wget http://nginx.org/download/nginx-1.16.1.tar.gz 准备 ModSecurity-nginx、nchan、nginx-http-flv-module、nginx-upstream-dynamic-servers模块 编译 解压并进入nginx目录 ./configure –prefix=/etc/nginx –sbin-path=/usr/sbin/nginx –modules-path=/usr/lib/nginx/modules –conf-path=/etc/nginx/nginx.conf –error-log-path=/var/log/nginx/error.log –http-log-path=/var/log/nginx/access.log –pid-path=/var/run/nginx.pid –lock-path=/var/run/nginx.lock –http-client-body-temp-path=/var/cache/nginx/clienttemp –http-proxy-temp-path=/var/cache/nginx/proxytemp –http-fastcgi-temp-path=/var/cache/nginx/fastcgitemp –http-uwsgi-temp-path=/var/cache/nginx/uwsgitemp –http-scgi-temp-path=/var/cache/nginx/scgitemp –user=nginx –group=nginx –with-compat –with-file-aio –with-threads –with-httpadditionmodule –with-httpauthrequestmodule –with-httpdavmodule –with-httpflvmodule –with-httpgunzipmodule –with-httpgzipstaticmodule –with-httpmp4module –with-httprandomindexmodule –with-httprealipmodule –with-httpsecurelinkmodule –with-httpslicemodule –with-httpsslmodule –with-httpstubstatusmodule –with-httpsubmodule –with-httpv2module –with-mail –with-mailsslmodule –with-stream –with-streamrealipmodule –with-streamsslmodule –with-streamsslprereadmodule –with-cc-opt='-g -O2 -Wno-address -fdebug-prefix-map=/data/builder/debuild/nginx-1.16.1/debian/debuild-base/nginx-1.16.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wp,-DFORTIFY_SOURCE=2 -fPIC' –with-ld-opt='-Wl,-z,relro -Wl,-z,now -Wl,–as-needed -pie' –with-cc-opt=-Wimplicit-fallthrough=0 –add-module=../nginx-upstream-dynamic-servers –add-module=../ModSecurity-nginx –add-module=../nchan-1.2.7 –add-module=../nginx-http-flv-module 编译安装 make && make install 替换版本 cp /usr/sbin/nginx.old /xxx备份原有版本 nginx -s reload nginx -V