码迷,mamicode.com
首页 > 其他好文 > 详细

nginx搭建flv、mp4流媒体服务

时间:2014-06-18 18:05:49      阅读:267      评论:0      收藏:0      [点我收藏+]

标签:style   code   http   tar   ext   color   

1、安装pcre-8.33.tar.bz2

#tar -xvf 1.pcre-8.33.tar.bz2

#cd pcre-8.33/

#./configure

#make && make install

2、安装openssl-1.0.1h.tar.gz

#tar -xvf openssl-1.0.1h.tar.gz

# cd openssl-1.0.1h/

#./config 

#make && make install

3、添加mp4支持模块

下载 http://h264.code-shop.com/download/nginx_mod_h264_streaming-2.2.7.tar.gz

#tar -xvf 3.nginx_mod_h264_streaming-2.2.7.tar.gz

 

4、安装nginx

#tar -xvf 4.nginx-1.7.1.tar.gz 

#cd nginx-1.7.1/

#./configure --add-module=/HLS/nginx_mod_h264_streaming-2.2.7 --with-http_ssl_module --prefix=/usr/local/nginx --with-http_flv_module  --with-http_stub_status_module

注意:nginx安装时,报错/HLS/nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c: In function ‘ngx_streaming_handler’:,此时需要修改src/ngx_http_streaming_module.c:

 

/* TODO: Win32 */

if (r->zero_in_uri)

{

return NGX_DECLINED;

}

 

将以上代码删除注释掉,重新编译安装。

 

/* TODO: Win32 */

//if (r->zero_in_uri)

//{

//return NGX_DECLINED;

//}

 

 5、nginx配置文件 nginx.conf  

#user www www;
worker_processes 30;
error_log /usr/local/nginx/logs/error.log crit;
pid /usr/local/nginx/logs/nginx.pid;
events {
use epoll;
worker_connections 65535;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main ‘$remote_addr - $remote_user [$time_local] ‘

‘"$request" $status $bytes_sent ‘

‘"$http_referer" "$http_user_agent" ‘

‘"$gzip_ratio"‘;

keepalive_timeout 60;

server_names_hash_bucket_size 128;

client_header_buffer_size 32k;

large_client_header_buffers 4 32k;

access_log off;

gzip on;

gzip_min_length 1100;

gzip_buffers 4 8k;

gzip_types text/plain;

output_buffers 1 32k;

postpone_output 1460;

client_header_timeout 3m;

client_body_timeout 3m;

send_timeout 3m;

sendfile on;

tcp_nopush on;

tcp_nodelay on;

 

######################################################################
server {

listen 8888;

server_name 192.168.245.133;

root /WebFiles/;

limit_rate_after 5m; ####在flv视频文件下载了5M以后开始限速

limit_rate 512k; ####速度限制为512K

index index.html;

charset utf-8;

location ~ \.flv {

flv;

}

location ~ \.mp4$ {
mp4;
}

error_page 500 502 503 504 /50x.html;

location = /50x.html {

root html;

}

 

}

}

 

 

nginx搭建flv、mp4流媒体服务,布布扣,bubuko.com

nginx搭建flv、mp4流媒体服务

标签:style   code   http   tar   ext   color   

原文地址:http://www.cnblogs.com/czrwxw/p/3790966.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!