yum编译安装的nginx增加新模块nginx-http-flv-module

思路:下载nginx对应版本的编译安装包,利用./configue进行重新编译,然后覆盖yum安装目录下的nginx nginx.pid nginx.conf

1.先下载nginx对应版本的编译安装包

1.先切到nginx目录中cd /usr/local/nginx查看nginx版本, nginx -V
2.可以先备份一下这个目录下nginx 、 nginx.pid 、 nginx.conf 文件,利用cp命令如

cp nginx /root/workspace

3.下载对应nginx包

cd /usr/local/src
wget http://nginx.org/download/nginx-1.18.0.tar.gz

4.解压nginx

tar zxvf nginx-1.18.0.tar.gz
cd  nginx-1.18.0

5.利用./configure -help查看支持哪些模块,我看了没有rtmp,因为nginx-http-flv-module含rmtp,所以下载这个模块即可。所以下载包来引入。阿里云git clone慢的话可以百度解决一下,禁用一个参数即可。

cd /usr/local/src
git clone https://github.com/winshining/nginx-http-flv-module.git


5.因为我通过histroy命令找到之前编译的./configure 后的模块参数,如果不记得话可以百度一下怎么新增模块(我试了还是覆盖了,没成功,所以重新编译)或者尽量把需要的模块都编译进行吧。我的参数中有些模块是之前安装时已经下载好的模块,所以可以直接引用,如果用下面参数提示找不到的话可以百度去下载相应模块。

cd /usr/local/src/nginx-1.18.0

为了方便看,我将命令换行了
 ./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/nginx 
 --conf-path=/usr/local/nginx/nginx.conf 
 --pid-path=/usr/local/nginx/nginx.pid 
 --with-http_gzip_static_module 
 --with-http_stub_status_module 
 --with-file-aio 
 --with-http_realip_module 
 --with-http_ssl_module 
 --with-pcre=/usr/local/src/pcre-8.44 
 --with-zlib=/usr/local/src/zlib-1.2.11 
 --with-openssl=/usr/local/src/openssl-1.1.1g 
 --with-http_mp4_module 
 --with-http_flv_module  
 --add-module=/usr/local/src/nginx-http-flv-module
不换行命令如下:
./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_gzip_static_module --with-http_stub_status_module --with-file-aio --with-http_realip_module --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.44 --with-openssl=/usr/local/src/openssl-1.1.1g --with-http_mp4_module --with-http_flv_module  --add-module=/usr/local/src/nginx-http-flv-module

make -j2

make install

6.到此回到目录cd /usr/local/nginx 通过./nginx -V可以看到有rtmp模块了。
感觉yum安装有点不方便,以后还是尽量编译安装,哈哈。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值