Nginx RTMP 模块安装与使用教程

Nginx RTMP 模块安装与使用教程

nginx-rtmp-module nginx-rtmp-module 项目地址: https://gitcode.com/gh_mirrors/ngin/nginx-rtmp-module

1. 项目目录结构及介绍

nginx-rtmp-module/
├── conf/
│   ├── nginx.conf
│   └── rtmp.conf
├── src/
│   ├── core/
│   ├── http/
│   ├── mail/
│   ├── misc/
│   ├── os/
│   ├── stream/
│   └── rtmp/
├── test/
│   ├── rtmp/
│   └── http/
├── README.md
├── LICENSE
└── INSTALL

目录结构介绍

  • conf/: 存放项目的配置文件,包括 nginx.confrtmp.conf
  • src/: 项目的源代码目录,包含核心模块、HTTP模块、邮件模块、杂项模块、操作系统相关模块、流媒体模块以及RTMP模块。
  • test/: 测试文件目录,包含RTMP和HTTP的测试文件。
  • README.md: 项目的基本介绍和使用说明。
  • LICENSE: 项目的开源许可证文件。
  • INSTALL: 项目的安装说明文件。

2. 项目启动文件介绍

项目的启动文件主要是 nginx.conf,该文件位于 conf/ 目录下。nginx.conf 是 Nginx 的主配置文件,包含了 HTTP 和 RTMP 服务的配置。

nginx.conf 文件结构

# 全局配置
user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;

# 事件配置
events {
    worker_connections  1024;
}

# HTTP 配置
http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
}

# RTMP 配置
rtmp {
    server {
        listen 1935;

        application live {
            live on;
            record off;
        }
    }
}

启动命令

nginx -c /path/to/nginx.conf

3. 项目配置文件介绍

rtmp.conf 文件结构

rtmp {
    server {
        listen 1935;

        application live {
            live on;
            record off;
        }

        application vod {
            play /var/vod;
        }
    }
}

配置文件介绍

  • rtmp: RTMP 模块的顶级配置块。
  • server: 定义一个 RTMP 服务器实例。
  • listen: 指定 RTMP 服务器的监听端口,通常为 1935。
  • application: 定义一个 RTMP 应用,例如 livevod
    • live on: 启用直播功能。
    • record off: 关闭录制功能。
    • play /var/vod: 指定视频点播的文件路径。

通过以上配置,可以实现 RTMP 直播和点播功能。


以上是 Nginx RTMP 模块的安装与使用教程,涵盖了项目的目录结构、启动文件和配置文件的详细介绍。希望对你有所帮助!

nginx-rtmp-module nginx-rtmp-module 项目地址: https://gitcode.com/gh_mirrors/ngin/nginx-rtmp-module

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

杜腾金Beguiling

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值