nginx《一》:最快速使用nginx搭建RTMP服务器

欢迎转载请注明出处:海漩涡

http://blog.csdn.net/tanhuifang520


                                         最快速使用nginx搭建RTMP服务器


一、下载安装源码

(1)下载nginx-1.8.1.tar.gz

http://nginx.org/en/download.html

(2)下载nginx的rtmp模块

https://github.com/arut/nginx-rtmp-module

       将两个源码放在同一目录下

       


二、编译安装

      cd nginx-1.8.1

      ./configure --add-module=../nginx-rtmp-module-master

    make

    sudo make install


三、运行

(1)sudo /usr/local/nginx/sbin/nginx

 (2)打开浏览器在网址出输入:localhost,如下图显示Welcome to nginx则运行成功

        


四、配置点播视频文件

(1)修改配置文件:/usr/local/nginx/conf/nginx.conf,添加RTMP配置  

worker_processes  1;

events {
    worker_connections  1024;
}
rtmp {                #RTMP服务
    server {
        listen 1935;  #//服务端口 
    chunk_size 4096;   #//数据传输块的大小

    application vod {
        play /opt/vide/vod; #//视频文件存放位置。
    }
    }
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    server {
        listen       80;
        server_name  localhost;
        location / {
            root   html;
            index  index.html index.htm;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

(2)将一个mp4文件test.mp4存放在/opt/video/vod/目录下

(3)重启nginx服务

sudo /usr/local/nginx/sbin/nginx -s reload



五、使用VLC点播视频

(1)媒体->打开网络串流


(2)输入URL:       rtmp://10.10.12.228/vod/test.mp4

URL中的IP为运行nginx的主机IP。



(3)点击上图右下角的播放,就能看到视频了



参考:http://blog.csdn.net/kingroc/article/details/50839994


欢迎转载请注明出处:海漩涡

http://blog.csdn.net/tanhuifang520



猜你喜欢

转载自blog.csdn.net/tanhuifang520/article/details/79612559