nginx - 在 ubuntu 14.04 上安装 Nginx+Rtmp 的问题
问题描述
使用本指南无法成功完成安装:https://docs.peer5.com/guides/setting-up-hls-live-streaming-server-using-nginx/
我总是在尝试使用 FFmpeg 从其他服务器推送流时出现 TCP&RTMP 错误。
我正在使用以下命令安装 nginx:
apt-get update
sudo apt install nginx
sudo apt install libnginx-mod-rtmp
apt install git
cd /usr/src
git clone git clone https://github.com/sergey-dryabzhinsky/nginx-rtmp-module.git
sudo apt-get install build-essential libpcre3 libpcre3-dev libssl-dev
wget http://nginx.org/download/nginx-1.10.1.tar.gz
tar -xf nginx-1.10.1.tar.gz
cd nginx-1.10.1
./configure --with-http_ssl_module --add-module=../nginx-rtmp-module
make -j 1
sudo make install
conf file
nano /etc/nginx/nginx.conf
对于此命令,sudo apt install libnginx-mod-rtmp
我收到此错误 `E: Unable to locate package libnginx-mod-rtmp
这是我的 Nginx conf 文件,非常简单:
worker_processes auto;
events {
worker_connections 1024;
}
# RTMP configuration
rtmp {
server {
listen 1935; # Listen on standard RTMP port
chunk_size 4000;
application show {
live on;
# Turn on HLS
hls on;
hls_path /mnt/hls/;
hls_fragment 3;
hls_playlist_length 60;
# disable consuming the stream from nginx as rtmp
deny play all;
}
}
}
http {
sendfile off;
tcp_nopush on;
directio 512;
default_type application/octet-stream;
server {
listen 8080;
location / {
# Disable cache
add_header 'Cache-Control' 'no-cache';
# CORS setup
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length';
# allow CORS preflight requests
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
types {
application/dash+xml mpd;
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /mnt/;
}
}
}
寻求您的专业知识来指导我正确的解决方案,问候
解决方案
您至少需要 Ubuntu Bionic 才能拥有 libnginx-mod-rtmp https://packages.ubuntu.com/bionic/libnginx-mod-rtmp
您可以从源代码安装 rtmp 库。
推荐阅读
- firebase - Firebase Spark 中的 Cloud Functions 计划是否与 Blaze 计划在同一基础架构上?
- javascript - 导入的变量未翻译
- react-native - 无法将没有 YogaNode 的子节点添加到没有度量函数的父节点
- algorithm - 不确定如何分解此分配任务
- ruby - return 语句中的空值表达式错误
- classification - Weka:不兼容的训练和测试集
- javascript - 在 javascript 横幅中使用 css 模糊图像
- java - Maven 和 Hibernate JPA 项目错误
- qt - 使用 cygwin 在 Nucleus 中构建 QT 应用程序
- math - 阅读下面的解释,因为我不知道如何构建这个