Chinaunix首页 | 论坛 | 博客
  • 博客访问: 249581
  • 博文数量: 188
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: -30
  • 用 户 组: 普通用户
  • 注册时间: 2017-03-29 11:17
文章分类
文章存档

2013年(8)

2012年(5)

2011年(13)

2010年(26)

2009年(63)

2008年(20)

2007年(32)

2006年(21)

分类: LINUX

2012-02-15 17:10:47

 前言:

互联网上播放视频的两种方式:

一种是以http协议方式来访问视频文件,这种方式的缺点是不能从视频特定的帧位置进行播放,必须从头开始。常用的方案是Appache+前端flv播放器。

另外一种方式是搭建专门的复杂的流媒体服务器,优点是视频支持拖拽播放,缺点是这种服务器搭建复杂,配置要求也比较高,而且运行其上的程序必须是某种语言。

这里配置flv播放器,主要是使用jw playerlighttpd搭建一个在线的flv流媒体播放功能。而且lighttpd也是有mod_flv_streaming模块来支持flv视频的流播放功能。

软件列表

1.       pcre-8.21.zip ()

2.       lighttpd-1.4.30.tar.gz ()

3.       jw player ()

一、安装PcreLighttpd

##########配置yum#########

#wget

#rpm –ivh rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

 

##########安装pcre#########

#tar xf pcre-8.21.tar.gz
#cd pcre-8.21
#./configure
#make
#make install


######lighttpd的编译安装 ######
#tar xf lighttpd-1.4.19.tar.gz
#cd lighttpd-1.4.19
#./configure --prefix=/usr/local/lighttpd
#make
#make install


########lighttpd的配置文件、用户组和用户的配置#######
#mkdir /usr/local/lighttpd/etc

#mkdir /usr/local/lighttpd/etc/conf.d
#cp doc/config/lighttpd.conf  /usr/local/lighttpd/etc

#cp doc/rc.lighttpd /etc/init.d/lighttpd

#cd doc/config/conf.d/* /usr/local/lighttpd/etc/conf.d/
#groupadd lighttpd
#useradd -g lighttpd lighttpd

########启动脚本参数修改,启动脚本在本文下半部分提供 #######
#vi /etc/init.d/lighttpd
修改LIGHTTPD_CONF_PATH =/etc/sysconfig/lighttpd/usr/local/lighttpd/etc/lighttpd.conf
修改lighttpd =/usr/sbin/lighttpd/usr/local/lighttpd/sbin/lighttpd

二、lighttpd的配置和使用

server.document-root 改为你的网站的根目录(/www)

server.errorlog 改为错误日志的路径(/usr/local/lighttpd/logs/error.log)
accesslog.filename
改为访问日志的路径(/usr/local/lighttpd/logs/access.log)

modules.conf       lighttpd模块配置文件

server.modules      根据需要启动模块

include "conf.d/fastcgi.conf"  fastcgi文件文件

 

1.       ##############/usr/local/lighttpd/etc/lighttpd.conf配置文件###########

var.log_root    = "/var/log"

var.server_root = "/var/www"

var.state_dir   = "/var/run"

var.home_dir    = "/var/lib/lighttpd"

var.conf_dir    = "/etc/lighttpd"

var.vhosts_dir  = server_root + "/vhosts"

var.cache_dir   = "/var/cache/lighttpd"

var.socket_dir  = home_dir + "/sockets"

include "modules.conf"

server.port = 80

server.username  = "lighttpd"

server.groupname = "lighttpd"

server.document-root = server_root + "/htdocs"

server.pid-file = state_dir + "/lighttpd.pid"

server.errorlog             = log_root + "/error.log"

include "conf.d/access_log.conf"

include "conf.d/fastcgi.conf"

server.event-handler = "linux-sysepoll"

server.network-backend = "linux-sendfile"

server.max-fds = 2048

server.stat-cache-engine = "simple"

server.max-connections = 1024

index-file.names += (

  "index.xhtml", "index.html", "index.htm", "default.htm", "index.php"

)

url.access-deny             = ( "~", ".inc" )

$HTTP["url"] =~ "\.pdf$" {

  server.range-requests = "disable"

}

static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".scgi" )

include "conf.d/mime.conf"

include "conf.d/dirlisting.conf"

server.follow-symlink = "enable"

server.upload-dirs = ( "/var/tmp" )

 

2.       ################模块配置文件:/usr/local/lighttpd/etc/modules.conf##########

server.modules = (

"mod_access",

"mod_flv_streaming")

flv-streaming.extensions = ( ".flv" )

include "conf.d/secdownload.conf"

 

3.       #################fastcgi.conf 的配置文件################

 

erver.modules += ( "mod_fastcgi" )

fastcgi.server = ( ".php" =>

                   ( "php-tcp" =>

                     (

                       "host" => "127.0.0.1",

                       "port" => 9000,

                       "check-local" => "disable",

                       "broken-scriptfilename" => "enable",

                     )

                   ),

                )

 

4.       ##############Secdownload防盗链设置#############

server.modules+ = ("mod_secdownload") # 加上该模块
secdownload.secret = "abc" #
密钥,在你后面都程序要用到
secdownload.document-root = "/home/www/down/" #
真实文件路径,尽可能在web服务器之外
secdownload.uri-prefix = "/flv/" #
访问时uri前缀
secdownload.timeout = 10 #
超时时间设置,过期后会显示找不到页面

 

server.modules += ( "mod_secdownload" )

secdownload.document-root = server_root + "/downloads"

secdownload.secret = "abc"

secdownload.timeout = 60

secdownload.uri-prefix = "/flv/"

 
。。。。。
。。。。。
 
详细配置请参考附件《Lighttpd搭建Flv可拖拽媒体服务器》
 
 
最终访问效果:
 
阅读(2038) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~