1.新建文件夹nginx-rtmp
2.将《Windows下nginx-http-flv-module编译》生成的nginx.exe拷贝到nginx-rtmp目录下
3.将nginx源码目录下的conf文件夹拷贝到nginx-rtmp目录下
4.将nginx源码目录下的docs/html文件夹拷贝到nginx-rtmp目录下
5.在nginx-rtmp目录下新建logs和temp文件夹
6.将nginx-http-flv-module目录下的stat.xsl拷贝到nginx-rtmp/html目录下
7.配置conf/nginx.conf文件
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#error_log logs/error.log debug;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
# 添加RTMP服务
rtmp {
server {
listen 1935; # 监听端口
chunk_size 4000;
application live {
live on;
gop_cache on;
}
}
}
# HTTP服务
http {
include mime.types;
default_type application/octet-stream;
#access_log logs/access.log main;
server {
listen 8080; # 监听端口
location /stat.xsl {
root html;
}
location /stat {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
}
location / {
root html;
}
}
}
8.整个服务部署文件构架如下
nginx-rtmp
│ nginx.exe
│
├─conf
│ fastcgi.conf
│ fastcgi_params
│ koi-utf
│ koi-win
│ mime.types
│ nginx.conf
│ scgi_params
│ uwsgi_params
│ win-utf
│
├─html
│ 50x.html
│ index.html
│ stat.xsl
│
├─logs
│ access.log
│ error.log
│
└─temp
├─client_body_temp
├─fastcgi_temp
├─proxy_temp
├─scgi_temp
└─uwsgi_temp
9.启动nginx
a.进入nginx-rtmp目录下双击nginx.exe
b.WIN+R->cmd命令行进入nginx-rtmp目录下执行 start /b nginx.exe -c conf\nginx.conf
10.使用ffmpeg推流,VLC拉流
11.网页打开http://your_ip:8080/stat可以看到nginx媒体流的状态
12.关闭nginx
WIN+R->cmd命令行进入nginx-rtmp目录下执行 nginx.exe –s stop
13.下载本文部署好的戳这里