MAC 上编译安装nginx-rtmp-module 流媒体服务器
MAC 上编译安装nginx-rtmp-module 流媒体服务器
记录踩坑过程
下载nginx和nginx-rtmp-module
wget http://nginx.org/download/nginx-1.15.3.tar.gz
git clone https://github.com/arut/nginx-rtmp-module
生成makefile
tar -zxvf nginx-1.15.3.tar.gz
cd nginx-1.15.3
./configure --prefix=/data/server/nginx --with-http_ssl_module --add-module=../nginx-rtmp-module
到这一步的时候碰到如下错误:
checking for OpenSSL library ... not found
checking for OpenSSL library in /usr/local/ ... not found
checking for OpenSSL library in /usr/pkg/ ... not found
checking for OpenSSL library in /opt/local/ ... not found
./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option.
执行一下openssl,看是否openssl已经安装。
openssl
如果没有安装,执行下面的命令进行安装:
brew install openssl
有可能最后openssl没有安装到系统会自动搜索的那几个目录。我的mac上就不是。按照提示加上路径即可:
./configure --prefix=/Users/username/nginx --with-http_ssl_module --add-module=../nginx-rtmp-module --with-openssl=/usr/local/opt/openssl@1.1
成功后出现如下提示:
Configuration summary
+ using system PCRE library
+ using OpenSSL library: /usr/local/opt/openssl@1.1
+ using system zlib library
nginx path prefix: "/Users/chenhailiang/nginx"
nginx binary file: "/Users/chenhailiang/nginx/sbin/nginx"
nginx modules path: "/Users/chenhailiang/nginx/modules"
nginx configuration prefix: "/Users/chenhailiang/nginx/conf"
nginx configuration file: "/Users/chenhailiang/nginx/conf/nginx.conf"
nginx pid file: "/Users/chenhailiang/nginx/logs/nginx.pid"
nginx error log file: "/Users/chenhailiang/nginx/logs/error.log"
nginx http access log file: "/Users/chenhailiang/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp
make
执行make生成二进制文件:
make
报如下错误:
/Library/Developer/CommandLineTools/usr/bin/make -f objs/Makefile
cd /usr/local/opt/openssl@1.1 \
&& if [ -f Makefile ]; then /Library/Developer/CommandLineTools/usr/bin/make clean; fi \
&& ./config --prefix=/usr/local/opt/openssl@1.1/.openssl no-shared no-threads \
&& /Library/Developer/CommandLineTools/usr/bin/make \
&& /Library/Developer/CommandLineTools/usr/bin/make install_sw LIBDIR=lib
/bin/sh: ./config: No such file or directory
make[1]: *** [/usr/local/opt/openssl@1.1/.openssl/include/openssl/ssl.h] Error 127
make: *** [build] Error 2
执行如下的命令,修改一个文件
vim auto/lib/openssl/conf
把下面的几行中的.openssl去掉,然后保存
39 CORE_INCS="$CORE_INCS $OPENSSL/.openssl/include"
40 CORE_DEPS="$CORE_DEPS $OPENSSL/.openssl/include/openssl/ssl.h"
41 CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libssl.a"
42 CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libcrypto.a"
改成
39 CORE_INCS="$CORE_INCS $OPENSSL/include"
40 CORE_DEPS="$CORE_DEPS $OPENSSL/include/openssl/ssl.h"
41 CORE_LIBS="$CORE_LIBS $OPENSSL/lib/libssl.a"
42 CORE_LIBS="$CORE_LIBS $OPENSSL/lib/libcrypto.a"
注意:修改完之后需要重新执行一遍 configure,否则修改不生效。
再次make成功
make install
执行make install 安装nginx和nginx-rtmp-module到指定目录:
make install
修改配置文件
修改安装目录下面的conf/nginx.conf文件,添加rtmp配置:
rtmp {
server {
listen 1935;
application mytv {
live on;
}
}
}
启动服务
./sbin/nginx -c ./conf/nginx.conf
使用ffmpeg推流
ffmpeg -re -i /Users/username/test_sps_1.mp4 -vcodec libx264 -acodec aac -f flv rtmp://localhost:1935/mytv/home
ffplay 播放
ffplay -i. rtmp://localhost:1935/mytv/home
参考
https://blog.51cto.com/983836259/1835809
http://www.appblog.cn/2018/08/28/nginx-rtmp流媒体服务器搭建/
MAC 上编译安装nginx-rtmp-module 流媒体服务器的更多相关文章
- nginx + rtmp 搭建流媒体服务器
一.安装nginx服务器 1.路径说明: 路径:/usr/local/src 2.下载nginx-rtmp-module (我这里的目录是在/usr/local/src/下面) cd /usr/loc ...
- Mac Pro 编译安装 Nginx 1.8.1
#下载相关源码包,统一放到 /usr/local/src 目录下: http://nginx.org/download/nginx-1.8.1.tar.gz http://zlib.net/zlib- ...
- 在centos7上编译安装nginx
题前,先放一个有图有真相的博客链接:https://www.cnblogs.com/zhang-shijie/p/5294162.html 虽然别人说的很详细,但还是记录一下 1.VMWare Wor ...
- Windows 编译安装 nginx 服务器 + rtmp 模块
有关博客: <Windows 编译安装 nginx 服务器 + rtmp 模块>.<Ubuntu 编译安装 nginx>.<Arm-Linux 移植 Nginx> ...
- CentOS 7上重新编译安装nginx
CentOS 7的源所提供的nginx几乎不包含任何扩展模块:为了能够使用一些扩展模块,我们需要从源代码重新编译安装nginx. 目前最新版的源代码是1.6.1.下载解压后先不要急着configure ...
- nginx搭建rtmp协议流媒体服务器总结
最近在 ubuntu12.04+wdlinux(centos)上搭建了一个rtmp服务器,感觉还挺麻烦的,所以记录下. 大部分都是参考网络上的资料. 前提: 在linux下某个目录中新建一个nginx ...
- 初识Nginx及编译安装Nginx
初识Nginx及编译安装Nginx 环境说明: 系统版本 CentOS 6.9 x86_64 软件版本 nginx-1.12.2 1.什么是Nginx? 如果你听说或使用过Apache软件 ...
- Centos7 编译安装 Nginx、MariaDB、PHP
前言 本文主要大致介绍CentOS 7下编译安装Nginx.MariaDB.PHP.面向有Linux基础且爱好钻研的朋友.技艺不精,疏漏再所难免,还望指正. 环境简介: 系统: CentOS 7,最小 ...
- Ubuntu编译安装nginx以及配置自动启动
本文主要介绍ubuntu如何编译安装nginx以及遇到的问题 和 配置系统自动启动服务 查看操作系统版本 cat /etc/issue Ubuntu 18.04.3 LTS \n \l 更改镜 ...
随机推荐
- 你不是说你会Aop吗?
一大早,小王就急匆匆的跑过来找我,说:周哥,那个记录日志的功能我想请教一下. 因为公司某个项目要跟别的平台做对接,我们这边需要给他们提供一套接口.昨天,我就将记录接口日志的工作安排给了小王. 下面是我 ...
- 【Python 实例】面向对象 | 请输入一周中某天的名称的第一个字母来判断以下是星期几,如果第一个字母一样则继续判断第二个字母
[Python 实例]面向对象 | 请输入一周中某天的名称的第一个字母来判断以下是星期几,如果第一个字母一样则继续判断第二个字母 题目: 解答: 运行结果: 题目: 请输入一周中某天的名称的第一个字母 ...
- (恐怕是)写得最通俗易懂的一篇关于HashMap的文章——xx大佬这样说
先看再点赞,给自己一点思考的时间,微信搜索[沉默王二]关注这个有颜值却假装靠才华苟且的程序员. 本文 GitHub github.com/itwanger 已收录,里面还有一线大厂整理的面试题,以及我 ...
- KMP算法-从入门到进阶
题目描述 给定一个文本串text和模式串pattern,从文本串中找出模式串第一次出现的位置 先来看最简单的方法,方便理解题目,也就是暴力求解 暴力求解 放大上面的图,得到下面这个.题目要求匹配到整个 ...
- CSS基础知识(上)
1.创建结构化.语义丰富HTML 语义化标记是优秀HTML文档的基础. 语义化标记意味着在正确的地方使用正确的元素,从而得到有意义的文档. 有意义的文档可以确保尽可能多的人都能够使用. 1.1 ID和 ...
- java_方法的定义、调用、重载
方法的定义 1 概述 方法:就是将一个功能抽取出来,把代码单独定义在一个大括号内,形成一个单独的功能. 当我们需要这个功能的时候,就可以去调用.这样即实现了代码的复用性,也解决了代码冗余的现象. 2 ...
- 面试这么撩准拿offer,HashMap深度学习,扰动函数、负载因子、扩容拆分,原理和实践验证,让懂了就是真的懂!
作者:小傅哥 博客:https://bugstack.cn 沉淀.分享.成长,让自己和他人都能有所收获! 一.前言 得益于Doug Lea老爷子的操刀,让HashMap成为使用和面试最频繁的API,没 ...
- java 网络通信协议、UDP与TCP
一 网络通信协议 通过计算机网络可以使多台计算机实现连接,位于同一个网络中的计算机在进行连接和通信时需要遵守一定 的规则,这就好比在道路中行驶的汽车一定要遵守交通规则一样.在计算机网络中,这些连接和通 ...
- 初识HTML(二)
目录 HTML表格 HTML列表 HTML表格 表格主要显示.展示数据. 表格基本语法:<table>定义一个表格,<tr>定义表格中的一行,<td>定义一行中的某 ...
- Java indexof
java中字符串方法 indexof() indexof()可以返回输入的字符串在目标字符串中第一次出现的位置,如果没有出现返回int 0: