ubuntu rtmp nginx安装
时间: 2023-10-14 13:05:13 浏览: 110
要在Ubuntu上安装RTMP模块和Nginx,您可以按照以下步骤进行操作:
1. 更新系统:
```
sudo apt update
sudo apt upgrade
```
2. 安装编译工具和依赖项:
```
sudo apt install build-essential libpcre3 libpcre3-dev libssl-dev zlib1g-dev
```
3. 下载Nginx源码:
```
wget http://nginx.org/download/nginx-1.19.5.tar.gz
tar -zxvf nginx-1.19.5.tar.gz
cd nginx-1.19.5
```
4. 下载RTMP模块:
```
wget https://github.com/arut/nginx-rtmp-module/archive/master.zip
unzip master.zip
```
5. 编译安装Nginx:
```
./configure --add-module=../nginx-rtmp-module-master
make
sudo make install
```
6. 创建Nginx服务文件:
```
sudo nano /etc/systemd/system/nginx.service
```
7. 将以下内容粘贴到文件中:
```
[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s stop
[Install]
WantedBy=multi-user.target
```
8. 保存并关闭文件。
9. 设置Nginx开机自启动并启动服务:
```
sudo systemctl enable nginx
sudo systemctl start nginx
```
现在,您已经成功在Ubuntu上安装了RTMP模块和Nginx。您可以根据需要配置和使用RTMP服务器。
阅读全文