linux 中 nginx-rtmp 安装

编译安装

1、先下载这些东西:

特别注意:nginx-rtmp-module 一定要在linux环境下从git上直接拉下来,否则最后会出错:

[emerg] unknown directive "rtmp"

2、编译辅助模块

cd到openssl、pcre、zlib目录,进行

./configure

make && make install

3、编译nginx模块

cd到nginx目录,执行:

./configure --prefix=/usr/local/nginx --add-module=../nginx-rtmp-module --with-http_ssl_module --with-pcre=../pcre-8.42 --with-openssl=../openssl-1.1.0i --with-zlib=../zlib-1.2.11

make && make install

4、nginx配置,配置rtmp

vi /usr/local/nginx/conf/nginx_rtmp.conf

rtmp { # 配置RTMP模块

    server { # 服务器

        listen 1935; # 监听端口, 默认为1935

        chunk_size 4000; # 数据块大小 4000

        application live { # 应用名称, 可理解为直播房间的名称

            live on; # 直播 [on]开启

        }

    }

}

5、启动nginx

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx_rtmp.conf

非编译安装

1、拷贝前面编译好的包到对应虚拟机上,解压到/usr/local目录下

2、nginx配置,配置rtmp

vi /usr/local/nginx/conf/nginx_rtmp.conf

rtmp { # 配置RTMP模块

    server { # 服务器

        listen 1935; # 监听端口, 默认为1935

        chunk_size 4000; # 数据块大小 4000

        application live { # 应用名称, 可理解为直播房间的名称

            live on; # 直播 [on]开启

        }

    }

}

3、启动nginx

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx_rtmp.conf

参考信息

参考本地目录:

E:\05-tools\12-linux上需要编译的软件\01-nginx-rtmp

参考文章:

https://blog.csdn.net/liuchen1206/article/details/77771703

猜你喜欢

转载自blog.csdn.net/luoqiang616477607/article/details/81772708