ImageVerifierCode 换一换
格式:DOCX , 页数:10 ,大小:19.79KB ,
资源ID:8202891      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/8202891.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(centos6nginx+rtmp流媒服务器.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

centos6nginx+rtmp流媒服务器.docx

1、centos6nginx+rtmp流媒服务器RTMP(Real Time Messaging Protocol)实时消息传送协议是Adobe Systems公司为Flash播放器和服务器之间音频、视频和数据传输开发的私有协议需要的软件:Nginx运行主程序;nginx_mod_h264_streamin MP4支持模块;nginx-accesskey资源防盗 链支持模块;yamdi渐进式流支持模块;1、 安装依赖包:#yumyupdate#yum-yinstallgccglibcglibc-develmakenasmpkgconfiglib-developenssl-develexpat-de

2、velgettext-devellibtoolmhash.x86_64perl-Digest-SHA1.x86_64gcc-c+glibc.i6862、安装git工具:/新安装的软件都放在新建的softsource文件夹下#mkdirsoftsource#cdsoftsource#wgethttp:/www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.gz#tarxzvfgit-latest.tar.gz#cdgit-2015-11-23#autoconf#./configure#make&makeinstall#gi

3、t-versiongitversion2.8.1.GIT#cd.hwclock -set -date=月/日/年 小时:分钟:秒钟hwclock -hctosys比如:hwclock -set -date=07/24/2012 12:33:22hwclock -hctosys是让上面设置的硬件时间同系统3、安装ffmpeg及其依赖包:+Yasm+#wget#tarxzvfyasm-1.2.0.tar.gz#cdyasm-1.2.0#./configure#make#makeinstall#cd.+x264+#gitclonegit:/git.videolan.org/x264#cdx264#.

4、/configure-enable-shared#make#makeinstall#cd.+LAME+(#wget#wget(安装lame-3.98.4.tar.gz,以免在第三步的时候出现ERROR:libmp3lame=3.98.3notfound错误,需要提前安装lame.)#tarxzvflame-3.98.4.tar.gz#cdlame-3.98.4#./configure-enable-nasm#make#makeinstall#cd.+libogg+#wgethttp:/downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz#tar

5、xzvflibogg-1.3.0.tar.gz#cdlibogg-1.3.0#./configure#make#makeinstallecho /usr/local/lib /etc/ld.so.conf.d/local-libraries.confexport PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH#cd.+libvorbis+#wgethttp:/downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz#tarxzvflibvorbis-1.3.3.tar.

6、gz#cdlibvorbis-1.3.3#./configure#make#makeinstall#cd.+libvpx+#wgetgit clone http:/git.chromium.org/webm/libvpx.git#tar-vxjflibvpx-v1.1.0.tar.bz2#cdlibvpx-v1.1.0#./configure-enable-shared#make#makeinstall#cd.+FAAD2+#wget#tarzxvffaad2-2.7.tar.gz#cdfaad2-2.7#./configure#make#makeinstall#cd.+FAAC+#wget#

7、tarzxvffaac-1.28.tar.gz#cdfaac-1.28#cdcommon/mp4v2/#vimpeg4ip.h从123行开始定位到129行后,保持退出修改前:#ifdef _cplusplusextern C #endifchar *strcasestr(const char *haystack, const char *needle);#ifdef _cplusplus#endif修改后:#ifdef _cplusplusextern C+ #endifconst char *strcasestr(const char *haystack, const char *needl

8、e);#ifdef _cplusplus#endif回到faac-1.28目录下:cd.Cd.#./configure#make#makeinstall#cd.+Xvid+#wgethttp:/downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz#tarzxvfxvidcore-1.3.2.tar.gz#cdxvidcore/build/generic#./configure#make#makeinstall#cd.+ffmpeg+#gitclonegit:/source.ffmpeg.org/ffmpeghttp:/ffmpeg.org/rel

9、eases/ffmpeg-2.8.2.tar.bz2#cdffmpeg#./configure-prefix=/opt/ffmpeg/-enable-version3-enable-libvpx-enable-libfaac-enable-libmp3lame-enable-libvorbis-enable-libx264-enable-libxvid-enable-shared-enable-gpl-enable-postproc-enable-nonfree-enable-avfilter-enable-pthreads#make&makeinstall#cd.+zlib+#wget#ta

10、rxzvfzlib-1.2.8.tar.gz#cdzlib-1.2.8#./configure-prefix=/usr/local/zlib#make&makeinstall修改/etc/ld.so.conf如下:includeld.so.conf.d/*.conf/lib/lib64/usr/lib/usr/lib64/usr/local/lib/usr/local/lib64/opt/ffmpeg/lib#ldconfig二、安装Nginx相关模块#wgethttp:/h264.code-#tarzxvfnginx_mod_h264_streaming-2.2.7.tar.gz#gitcl

11、onegit:/#wget#tarzxvfpcre-8.12.tar.gz#cdpcre-8.12#./configureprefix=/usr/local/pcre#make&makeinstall#cd.下载nginx-1.9.7安装包#wgethttp:/nginx.org/download/nginx-1.9.7.tar.gz#tarzxvfnginx-1.9.7.tar.gz#cdnginx-1.9.7#groupaddwww#useradd-gwwwwww#cd.#cdnginx_mod_h264_streaming-2.2.7/src#vingx_http_streaming_m

12、odule.c删除以下内容if (r-zero_in_uri) return NGX_DECLINED; #cd.#cdnginx-1.5.3#./configure-prefix=/usr/local/nginx-add-module=./nginx_mod_h264_streaming-2.2.7-with-http_ssl_module-with-pcre=/root/softsource/pcre-8.12with-zlib=/root/softsource/zlib-1.2.8-user=www-group=www-with-http_flv_module-with-http_stu

13、b_status_module-add-module=./nginx-rtmp-module或者./configure -user=www -group=www -prefix=/usr/local/nginx -with-http_stub_status_module -with-http_ssl_module -with-http_flv_module -with-http_gzip_static_module -with-http_mp4_module -with-cc-opt=-I/opt/ffmpeg/include -with-ld-opt=-L/opt/ffmpeg/lib -W

14、l,-rpath=/opt/ffmpeg/lib -add-module=/server/nginx_mod/nginx_mod_h264_streaming/ -add-module=/server/nginx_mod/nginx_mod_rtmp/ -with-pcre=/server/nginx_mod/nginx_mod_pcre#make#makeinstall#cd.三、安装yamdiyadmi的作用是为flv文件添加关键帧,才能实现拖动播放下载yadmi#wget安装yadmi#tarxzvfyamdi-1.4.tar.gz#cdyamdi-1.4#make&makeinstal

15、l#cd.使用方法:yamdi-iinput.flv-oout.flv给input.flv文件添加关键帧,输出为out.flv文件# wget http:/www.openssl.org/source/openssl-1.0.1c.tar.gz# tar -zxvf openssl-1.0.1c.tar.gz# ./config# make# make install#cp /root/nginx-rtmp-module/test /usr/local/nginx/html/nginx-rtmp-module/#cp /root/nginx-rtmp-module/stat.xsl /usr/

16、local/nginx/html/nginx-rtmp-module/四、修改nginx主配置文件,配置虚拟主机(注意空格)#cd/usr/local/nginx/conf#vinginx.conf修改为以下内容(根据自身情况修改):userwwwwww;worker_processes30;error_log/usr/local/nginx/logs/error.logcrit;pid/usr/local/nginx/logs/nginx.pid;eventsuseepoll;worker_connections65535;httpincludemime.types;default_type

17、application/octet-stream;log_formatmain$remote_addr$remote_user$time_local”$request”$status$bytes_sent”$http_referer”“$http_user_agent”$gzip_ratio”;keepalive_timeout60;server_names_hash_bucket_size128;client_header_buffer_size32k;large_client_header_buffers432k; /有空格client_max_body_size 50m;Limit_co

18、nn_zone $ binary_remote_addr zone=one:256k;limit_conn_log_level notice;access_log/usr/local/nginx/logs/access.log;gzipon;gzip_min_length1100;gzip_buffers48k; /有空格gzip_typestext/plain;output_buffers132k; /有空格postpone_output1460;client_header_timeout3m;client_body_timeout3m;send_timeout3m;sendfileon;t

19、cp_nopushon;tcp_nodelayon;#serverlisten8081;server_name172.16.10.200;#设置主机iproot/usr/local/nginx/html/flv_file/;limit_rate_after5m;#在flv视频文件下载了5M以后开始限速limit_rate512k;#速度限制为512Kindexindex.html;charsetutf-8;location.flvflv;location.mp4mp4:locationroothtml;indexindex.htmlindex.htmindex.php;error_page50

20、0502503504/50x.html;location=/50x.htmlroothtml;保存退出;#cd.五、基本上已经设置完毕,但是此时我们测试的时候还需要一个支持拖拽播放的flash播放器,开源的JWPlayer就可以实现这样的功能下载播放器后,上传到上面设置的/usr/local/nginx/html/目录下,并把flv视频文件也放到该目录下!播放器放到与index.html同级。这个时候需要安装rar:#wget#tarzxvfrarlinux-3.8.0.tar.gz-C/usr/local#yuminstallglibc.i686#yuminstalllibstdc+.so.

21、6此时,/usr/local/rar下就会有rar命令和unrar命令。进入到nginx下的html文件夹下载视频播放工具player.swf#cd#cd/usr/local/nginx/html#lsl可以看到解压到的文件;六、根据nginx的配置文件的中的配置设置端口号#vi/etc/sysconfig/iptables开放8081端口#/sbin/serviceiptablesrestart重启防火墙,设置生效修改防火墙配置文件,所在目录/etc/sysconfig/iptables,在里面增加需要开通的端口号,如下:12 -AINPUT-mstate-stateNEW-mtcp-ptc

22、p-dport80-jACCEPT-AINPUT-mstate-stateNEW-mtcp-ptcp-dport8088-jACCEPT#增加的代码必须放在以下代码之上,否则不会起作用.12 -AINPUT-jREJECT-reject-withicmp-host-prohibited-AFORWARD-jREJECT-reject-withicmp-host-prohibited七、启动nginx后测试:启动命令:#/usr/local/nginx/sbin/nginx-c/usr/local/nginx/conf/nginx.conf启动nginx的帮助文档:#/usr/local/ngi

23、nx/sbin/nginx-h#/usr/local/nginx/sbin/nginxsreload查看nginx的配置是否正确:#/usr/local/nginx/sbin/nginxt如果配置是正确的会显示如下内容:Nginx.confsyntaxisok.Nginx.conftestissuccessful.#/usr/local/nginx/sbin/nginx s quit优雅关闭#/usr/local/nginx/sbin/nginx s stop快速关闭#lynx localhost:端口 字符页面查看网页服务是否正常http:/127.0.0.1/player.swf?type

24、=http&file=mp42.mp4说明:#这里的127.0.0.1是自己的ip#player.swf是我的JWPlayer播放器#http是表示居于http分发方式#mp42.mp4是我的flv视频文件# 下载开源播放器jwplayercd /root/softsource/mkdir jwplayercd jwplayerwget # 如果不能下载,则需要到官网注册然后下载unzip jwplayer-7.7.2.zip# 复制播放器代码到站点文件夹,根据官方文档新建html文件播放页(省略)。cp -r jwplayer /usr/local/nginx/html/cd /usr/local/nginx/html/vi player.html#复制以下内容到player.html中保存cd /usr/local/nginx/htmlvi player.html#复制以下内容到player.html中保存播放测试script t

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1