1.首先 nginx -V 得到当前 nginx 的编译参数
1 2 3 4 5 6
| root@vultr:/usr/local/nginx/sbin# ./nginx -V nginx version: nginx/1.19.4 built by gcc 8.3.0 (Debian 8.3.0-6) built with OpenSSL 1.1.1d 10 Sep 2019 TLS SNI support enabled configure arguments: --prefix=/usr/local/nginx-1.9.3 --with-openssl=/usr/local/src/openssl-1.0.2 --with-pcre=/usr/local/src/pcre-8.37 --with-zlib=/usr/local/src/zlib-1.2.8 --with-http_ssl_module --with-http_ssl_module
|
2.备份当前nginx的可执行文件
3.下载所需的包和源码 并且解压
1 2 3 4 5 6
| wget http://nginx.org/download/nginx-1.19.4.tar.gz
wget https://github.com/sergey-dryabzhinsky/nginx-rtmp-module/archive/dev.zip
tar -zxvf nginx-1.19.4.tar.gz unzip dev.zip
|
如果提示找不到命令 unzip,需要先装 zip:apt-get install zip
4.下载 所需的工具
1
| sudo apt-get install build-essential libpcre3 libpcre3-dev libssl-dev gcc
|
5.编译安装
1 2 3 4 5
| cd nginx-1.19.4
./configure (把之前 nginx -V 得到的参数粘在这) --add-module=../nginx-rtmp-module-dev (确保模块路径正确)
make && make install
|
6.大功告成 如果编译安装完成 nginx无法启动 则将备份文件替换回去就好