zoukankan      html  css  js  c++  java
  • nginx搭建高性能流媒体技术

    一、 系统环境

    系统版本:

    CentOS 5.8x86_64 Nginx版本: Nginx-1.4.2.tar.gz Yamdi版本:Yamdi-1.9.tar.gz

    二、 自动化安装

    #!/bin/sh
    #Auto Make Install Nginx FLV MP4 Server
    #系统版本:CentOS 5.8 x86_64
    #Nginx版本: Nginx-1.4.2.tar.gz
    #Yamdi版本:Yamdi-1.9.tar.gz
    #Define Path
    SRC_DIR=/usr/src
    NGX_DIR=/usr/local/nginx/
    CODE=0
    SOFT_URL=(
                                                                              
        http://nginx.org/download/nginx-1.4.2.tar.gz
                                                                              
        http://downloads.sourceforge.net/project/yamdi/yamdi/1.9/yamdi-1.9.tar.gz
                                                                              
        http://chinaapp-wordpress.stor.sinaapp.com/uploads/2013/08/player.swf
                                                                              
    )
    if
        [ $UID  -ne $CODE ];then
        echo "Must to be use Root Exec Shell ......"
        exit 0
                                                                             
    fi
    for i  in  `echo ${SOFT_URL[0]} ${SOFT_URL[1]} ${SOFT_URL[2]} `
                                                                           
        do
                                                                              
        cd  $SRC_DIR  ;wget $i
                                                                              
        if
            [ "$?" == "$CODE" ];then
                                                                              
            echo "---------The $i Soft Download Success ! "
                                                                              
        else
                                                                                
            echo "---------The $i Soft Download Success ! "
                                                                           
        fi
                                                                             
    done
    #Nginx install Include Flv Mp4
    cd  $SRC_DIR ; tar -xzf  nginx-1.4.2.tar.gz ;cd nginx-1.4.2 && ./configure  --prefix=/usr/local/nginx --with-http_gzip_static_module  --with-http_stub_status_module  --with-http_flv_module --with-http_mp4_module && make &&make install
    if
        [ "$?" == "$CODE" ];then
        echo "The Nginx  Make install Success ! "
    else
        echo "The Nginx  Make install Failed ! "
    fi
    #Install  Yamdi Tools
        cd  $SRC_DIR ; tar -xzf  yamdi-1.9.tar.gz ;cd yamdi-1.9/ &&make &&make install
    #Config Nginx Service And Flv
        cp  wugk.mp4 player.swf  /usr/local/nginx/html/
                                                                               
        /usr/local/bin/yamdi -i 51cto.mp4 -o wugk.mp4
        grep -E "(flv|mp4)" $NGX_DIR/conf/nginx.conf
        [ $?  -eq  $CODE ]&&sed -i '46c \tlocation ~ .flv$ {
    	flv;
    	}
    	location ~ .mp4$ {
    	mp4;
    	}' /usr/local/nginx/conf/nginx.conf
                                                                              
    #start Nginx service
        $NGX_DIR/sbin/nginx -t
        [ $?  -eq  $CODE ]&&/usr/local/nginx/sbin/nginx
        IP=`ifconfig eth0|grep "Bcast" |awk -F":" '{print $2}'|cut -d" " -f 1`
        echo "All Config Successful , You Can Use http://$IP/player.swf?type=http&file=wugk.mp4 to access nginx flv server !!"
        exit 1
    三、测试验证
    脚本执行
  • 相关阅读:
    Centos6.6安装Nginx
    Centos6.6升级python版本
    基于Centos6.6的R720服务器四网口端口聚合的实践
    wcf 开发 1
    dev 转自
    SQL查询父节点下的所有子节点(包括子节点下的子节点,无限子节点)
    C# 自定义控件摘记
    C#中的自定义控件中的属性、事件及一些相关特性的总结(转)
    DevExpress控件-lookupedit的使用方法详解(图文)转http://blog.csdn.net/qq395537505/article/details/50920508
    【DevExpress】 SearchLookUpEdit
  • 原文地址:https://www.cnblogs.com/xuexin/p/5972595.html
Copyright © 2011-2022 走看看