首页
/ 【亲测免费】 Nginx-RTMP-Win32 项目使用教程

【亲测免费】 Nginx-RTMP-Win32 项目使用教程

2026-01-14 18:32:50作者:田桥桑Industrious

1. 项目目录结构及介绍

Nginx-RTMP-Win32 项目的目录结构如下:

nginx-rtmp-win32/
├── conf/
│   └── nginx.conf
├── html/
│   └── index.html
├── logs/
├── temp/
├── LICENSE
├── README.md
├── nginx.exe
└── stop.bat

目录结构说明:

  • conf/:包含 Nginx 的配置文件 nginx.conf
  • html/:包含一些示例 HTML 文件,如 index.html,用于测试直播和点播功能。
  • logs/:用于存放 Nginx 的日志文件,包括访问日志和错误日志。
  • temp/:用于存放临时文件,如客户端请求的临时文件。
  • LICENSE:项目的许可证文件,采用 BSD-2-Clause 许可证。
  • README.md:项目的说明文档。
  • nginx.exe:Nginx 的可执行文件,用于启动服务器。
  • stop.bat:用于停止 Nginx 服务的批处理文件。

2. 项目启动文件介绍

nginx.exe

nginx.exe 是 Nginx-RTMP-Win32 项目的启动文件。双击该文件即可启动 Nginx 服务器。启动后,Nginx 会监听默认的 RTMP 端口(1935)和 HTTP 端口(8080)。

stop.bat

stop.bat 是一个批处理文件,用于停止 Nginx 服务。可以通过双击该文件或在命令行中运行 stop.bat 来停止 Nginx 服务器。

3. 项目配置文件介绍

conf/nginx.conf

nginx.conf 是 Nginx-RTMP-Win32 项目的主要配置文件。以下是该配置文件的主要内容和说明:

# RTMP 配置
rtmp {
    server {
        listen 1935;
        application live {
            live on;
        }
        application hls {
            live on;
            hls on;
            hls_path temp/hls;
        }
    }
}

# HTTP 配置
http {
    server {
        listen 8080;
        location /stat {
            rtmp_stat all;
        }
        location /index.html {
            root html;
        }
        location /vod.html {
            root html;
        }
    }
}

配置文件说明:

  • RTMP 配置

    • listen 1935;:监听 1935 端口,用于 RTMP 流媒体传输。
    • application live { ... }:定义了一个名为 live 的应用程序,用于实时直播。
    • application hls { ... }:定义了一个名为 hls 的应用程序,用于 HLS(HTTP Live Streaming)直播。
  • HTTP 配置

    • listen 8080;:监听 8080 端口,用于 HTTP 服务。
    • location /stat { ... }:用于查看 RTMP 流的状态。
    • location /index.html { ... }:提供一个直播播放与直播发布测试页面。
    • location /vod.html { ... }:提供一个支持 RTMP 和 HLS 点播的测试页面。

通过修改 nginx.conf 文件,可以自定义 Nginx-RTMP-Win32 服务器的配置,以满足不同的流媒体需求。

登录后查看全文
热门项目推荐
相关项目推荐