源代码安装nginx+rtmp
环境介绍
- Centos7
- nginx 1.26
- nginx-rtmp-module
安装
准备基本依赖包
bash
yum -y install gcc \
gcc-c++ \
epel-release \
pcre \
pcre-devel \
zlib \
zlib-devel \
openssl \
openssl-devel \
git
准备nginx源代码和nginx-rtmp-module
bash
wget https://nginx.org/download/nginx-1.26.0.tar.gz && \
tar -zxvf nginx-1.26.0.tar.gz && \
cd nginx-1.26.0 && \
git clone https://gitee.com/zhong-liuyang/nginx-rtmp-module.git
编译和配置
这个步骤将nginx编译过后安装到linux 并且配置环境变量
bash
./configure --add-module=./nginx-rtmp-module && \
make && make install && \
ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/nginx
配置rtmp
编写/usr/local/nginx/conf/nginx.conf
text
events {
worker_connections 1024;
}
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
record off;
}
}
}
启动
bash
# 检查配置
nginx -t
# 启动
nginx -s reload