Documentation of filesite.io.
https://filesite.io
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
1.2 KiB
82 lines
1.2 KiB
2 years ago
|
|
||
|
# CentOS 7里如何编译安装Nginx-RTMP直播插件?
|
||
|
|
||
|
## 安装依赖包
|
||
|
|
||
|
```
|
||
|
yum -y install pcre pcre-devel openssl openssl-devel zlib zlib-devel unzip
|
||
|
```
|
||
|
|
||
|
|
||
|
## 下载最新版nginx源码
|
||
|
|
||
|
```
|
||
|
mkdir downloads/
|
||
|
cd downloads/
|
||
|
wget http://nginx.org/download/nginx-1.9.9.tar.gz
|
||
|
```
|
||
|
|
||
|
|
||
|
## 下载Nginx-RTMP插件源码
|
||
|
|
||
|
```
|
||
|
wget https://github.com/arut/nginx-rtmp-module/archive/master.zip -O rtmp.zip
|
||
|
```
|
||
|
|
||
|
|
||
|
## 解压缩源码
|
||
|
|
||
|
```
|
||
|
unzip rtmp.zip
|
||
|
tar -zxvf nginx-1.9.9.tar.gz
|
||
|
```
|
||
|
|
||
|
|
||
|
## 配置Nginx
|
||
|
|
||
|
```
|
||
|
cd nginx-1.9.9/
|
||
|
./configure --add-module=../nginx-rtmp-module-master/ --with-http_realip_module
|
||
|
```
|
||
|
|
||
|
|
||
|
## 编译安装Nginx
|
||
|
|
||
|
```
|
||
|
make && make install
|
||
|
```
|
||
|
|
||
|
确认安装成功:
|
||
|
```
|
||
|
/usr/local/nginx/sbin/nginx -v
|
||
|
```
|
||
|
|
||
|
|
||
|
## 启动nginx
|
||
|
|
||
|
```
|
||
|
/usr/local/nginx/sbin/nginx
|
||
|
```
|
||
|
|
||
|
如果需要用systemctl来启动nginx,
|
||
|
请修改nginx的服务配置文件:
|
||
|
```
|
||
|
cp /usr/lib/systemd/system/nginx.service /usr/lib/systemd/system/nginx_backup.service
|
||
|
vim /usr/lib/systemd/system/nginx.service
|
||
|
```
|
||
|
|
||
|
保存后reload配置:
|
||
|
```
|
||
|
systemctl daemon-reload
|
||
|
```
|
||
|
|
||
|
再尝试用systemctl启动nginx服务:
|
||
|
```
|
||
|
systemctl stop nginx
|
||
|
systemctl start nginx
|
||
|
```
|
||
|
|
||
|
|
||
|
参考:
|
||
|
> https://www.vultr.com/docs/setup-nginx-rtmp-on-centos-7
|