当前位置:首页 > CN2资讯 > 正文内容

windows下搭建基于nginx的rtmp服务器rtmp服务器搭建

5小时前CN2资讯

Windows机器配置:
Windows7旗舰版 64位
Intel(R) Core(TM)i5-2520 CPU @2.50GHz 2.50 GHz
内存: 4GB

1. 下载 nginx 1.7.11.3 Gryphon
下载链接: http://nginx-win.ecsds.eu/download/nginx 1.7.11.3 Gryphon.zip
下载完成后解压;
将解压后的目录名:
  nginx 1.7.11.3 Gryphon
改成:
  nginx-1.7.11.3-Gryphon

2. 下载服务器状态检查程序 stat.xsl
https:///arut/nginx-rtmp-module/

将nginx-rtmp-module-master.zip解压后复制到目录:nginx-1.7.11.3-Gryphon下,
保证stat.xls的目录为:
nginx-1.7.11.3-Gryphon\nginx-rtmp-module\stat.xsl

3. 配置文件 conf\nginx-win-rtmp.conf 内容如下:

#user  nobody; # multiple workers works ! worker_processes  2; #error_log  logs/error.log; #error_log  logs/error.log  notice; #error_log  logs/error.log  info; #pid        logs/nginx.pid; events {     worker_connections  8192;     # max value 32768, nginx recycling connections+registry optimization =      #   this.value * 20 = max concurrent connections currently tested with one worker     #   C1000K should be possible depending there is enough ram/cpu power     # multi_accept on; } rtmp {     server {         listen 1935;         chunk_size 4000;         application live {              live on;         }     } } http {     #include      /nginx/conf/naxsi_core.rules;     include       mime.types;     default_type  application/octet-stream;     #log_format  main  '$remote_addr:$remote_port - $remote_user [$time_local] "$request" '     #                  '$status $body_bytes_sent "$http_referer" '     #                  '"$http_user_agent" "$http_x_forwarded_for"';     #access_log  logs/access.log  main; #     # loadbalancing PHP #     upstream myLoadBalancer { #         server 127.0.0.1:9001 weight=1 fail_timeout=5; #         server 127.0.0.1:9002 weight=1 fail_timeout=5; #         server 127.0.0.1:9003 weight=1 fail_timeout=5; #         server 127.0.0.1:9004 weight=1 fail_timeout=5; #         server 127.0.0.1:9005 weight=1 fail_timeout=5; #         server 127.0.0.1:9006 weight=1 fail_timeout=5; #         server 127.0.0.1:9007 weight=1 fail_timeout=5; #         server 127.0.0.1:9008 weight=1 fail_timeout=5; #         server 127.0.0.1:9009 weight=1 fail_timeout=5; #         server 127.0.0.1:9010 weight=1 fail_timeout=5; #         least_conn; #     }     sendfile        off;     #tcp_nopush     on;     server_names_hash_bucket_size 128; ## Start: Timeouts ##     client_body_timeout   10;     client_header_timeout 10;     keepalive_timeout     30;     send_timeout          10;     keepalive_requests    10; ## End: Timeouts ##     #gzip  on;     server {         listen       80;         server_name  localhost;         location /stat {             rtmp_stat all;             rtmp_stat_stylesheet stat.xsl;         }         location /stat.xsl {             root nginx-rtmp-module/;         }         location /control {             rtmp_control all;         }         #charset koi8-r;         #access_log  logs/host.access.log  main;         ## Caching Static Files, put before first location         #location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {         #    expires 14d;         #    add_header Vary Accept-Encoding;         #} # For Naxsi remove the single # line for learn mode, or the ## lines for full WAF mode         location / {             #include    /nginx/conf/mysite.rules; # see also http block naxsi include line             ##SecRulesEnabled;          ##DeniedUrl "/RequestDenied";          ##CheckRule "$SQL >= 8" BLOCK;          ##CheckRule "$RFI >= 8" BLOCK;          ##CheckRule "$TRAVERSAL >= 4" BLOCK;          ##CheckRule "$XSS >= 8" BLOCK;             root   html;             index  index.html index.htm;         } # For Naxsi remove the ## lines for full WAF mode, redirect location block used by naxsi         ##location /RequestDenied {         ##    return 412;         ##} ## Lua examples ! #         location /robots.txt { #           rewrite_by_lua ' #             if ngx.var.http_host ~= "localhost" then #               return ngx.exec("/robots_disallow.txt"); #             end #           '; #         }         #error_page  404              /404.html;         # redirect server error pages to the static page /50x.html         #         error_page   500 502 503 504  /50x.html;         location = /50x.html {             root   html;         }         # proxy the PHP scripts to Apache listening on 127.0.0.1:80         #         #location ~ \.php$ {         #    proxy_pass   http://127.0.0.1;         #}         # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000         #         #location ~ \.php$ {         #    root           html;         #    fastcgi_pass   127.0.0.1:9000; # single backend process         #    fastcgi_pass   myLoadBalancer; # or multiple, see example above         #    fastcgi_index  index.php;         #    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;         #    include        fastcgi_params;         #}         # deny access to .htaccess files, if Apache's document root         # concurs with nginx's one         #         #location ~ /\.ht {         #    deny  all;         #}     }     # another virtual host using mix of IP-, name-, and port-based configuration     #     #server {     #    listen       8000;     #    listen       somename:8080;     #    server_name  somename  alias  another.alias;     #    location / {     #        root   html;     #        index  index.html index.htm;     #    }     #}     # HTTPS server     #     #server {     #    listen       443 ssl spdy;     #    server_name  localhost;     #    ssl                  on;     #    ssl_certificate      cert.pem;     #    ssl_certificate_key  cert.key;     #    ssl_session_timeout  5m;     #    ssl_prefer_server_ciphers On;     #    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;     #    ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:ECDH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!eNULL:!MD5:!DSS:!EXP:!ADH:!LOW:!MEDIUM;     #    location / {     #        root   html;     #        index  index.html index.htm;     #    }     #} }



4. 启动服务器
进入windows的cmd; 
> cd nginx-1.7.11.3-Gryphon
> nginx.exe -c conf\nginx-win-rtmp.conf

开始实现
第一步启动nginx:


随便打开一个浏览器出现下图就说明启动成功了:

好了服务器已经正常启动了,可以结合ffmpeg推流到本机服务器上了 
下载ffmpeg-static里面有可以直接执行的可执行文件ffmpeg.exe,官网上可以下载,自行下载。

第二步开始使用ffmpeg推流
跳转到ffmpeg.exe目录下

执行 ffmpeg.exe -re -i d:\temp\bmw.mp4 -f flv rtmp://localhost:1935/live/test

其中F:\renming\test.mp4是我电脑f盘上的一个MP4格式的文件,/live时是配置文件中application名称,/test随便定义都是可以的,只要播放器与这个地址一致就好

方法2. 流媒体播放器地址:http://www.cutv.com/demo/live_test.swf

    你可能想看:

    扫描二维码推送至手机访问。

    版权声明:本文由皇冠云发布,如需转载请注明出处。

    本文链接:https://www.idchg.com/info/31413.html

    分享给朋友:

    “windows下搭建基于nginx的rtmp服务器rtmp服务器搭建” 的相关文章

    香港CN2线路:提升跨境数据传输效率的最佳选择

    CN2线路的定义与背景 香港CN2线路是中国电信推出的一项先进网络服务,专门设计用于提供高质量的国际数据传输。这个网络服务的目标是解决传统网络在跨境数据传输时遇到的延迟和带宽限制问题。CN2线路的推出,标志着中国电信在网络技术上的一个重要进步,特别是在处理大量数据和高频率的跨境通信方面。 CN2线路...

    VPN测评:2023年最佳VPN服务推荐及选择指南

    当我第一次接触VPN时,感觉这个概念既神秘又充满吸引力。VPN,全称为虚拟专用网络,它为用户提供了一种安全、私人上网的方式。不论是为了保护个人隐私,还是为了突破地域限制,VPN已经成为现代网上活动中不可或缺的工具。 我发现VPN有许多用途。首先,它能加密我的网络连接,让我的在线活动在网络上变得更加私...

    选择DigitalVirt的KVM VPS服务,体验高性价比与稳定性

    DigitalVirt的成立是在2022年,这让我对他们的新起步感到兴奋。这家国人商家致力于提供高质量的KVM VPS服务,逐渐在市场上赢得了一席之地。就我个人的体验来看,DigitalVirt的使命似乎就是帮助用户实现在线业务的稳定与高效。特别是在快节奏的数字时代,能够找到一个可靠的服务提供商至关...

    如何有效利用闲置VPS:再利用与出租的最佳实践

    闲置VPS,这个词可能对很多人来说并不陌生,尤其是在互联网和云计算技术快速发展的今天。说白了,闲置VPS就是那些购买了却没有得到充分利用的虚拟私人服务器。很多用户在购买VPS后,可能由于项目需求的变化或者个人时间的限制,最终导致这些资源被闲置。这不仅仅是浪费金钱,也让我们的资源没有得到最好的应用。...

    Wikihost:构建高效知识库的理想WordPress主题

    Wikihost是一个专为WordPress平台设计的知识库主题,目的在于帮助用户轻松创建和管理知识库文章与文档页面。这款主题适合各种类型的网站,从小型企业到大型社区,用户都能通过它建立富有信息性的页面。Wikihost给用户提供了一整套便捷的功能,帮助他们分享知识和信息。 我发现Wikihost的...

    LightLayer云服务器评测与应用案例分析

    在我日常工作中,云服务器的选择至关重要,而我最近了解到的LightLayer云服务器,给我留下了深刻的印象。作为Megalayer旗下的品牌,LightLayer在全球多个重要地点部署了服务器,尤其是在美国洛杉矶、中国台湾台北和菲律宾马尼拉。这些选择不仅为用户提供了更快速的访问速度,也为他们的云计算...