Setup Lighttpd for Vedio Streaming

Lighttpd is said that much lighter that Apache. I tried to set it up for flv and H.264 streaming. The configuration is relatively easy.

1. Download lighttpd-1.4.29.tar.gz

2. Download lighttpd-1.4.18_mod_h264_streaming-2.2.0.tar.gz
(This is the patch for mod_h264)

3. Open tar ball of lighttpd
tar zxvf lighttpd-1.4.29.tar.gz

4. Patch h264-mod
mv lighttpd-1.4.29 lighttpd-1.4.18
tar zxvf lighttpd-1.4.18_mod_h264_streaming-2.2.0.tar.gz

5. config /etc/lighttpd.conf
basic setup:

server.port = 80
server.username = “lighttpd”
server.groupname = “lighttpd”
server.document-root = “/var/www”
server.tag = “lighttpd”
server.pid-file = “/var/run/lighttpd.pid”
server.errorlog = “/var/log/lighttpd/error.log”
include “conf.d/access_log.conf”
index-file.names += (
“index.html”, “index.htm”, “index.php”
)
include “conf.d/mime.conf”

6. module.conf
server.modules = (
“mod_access”,
“mod_fastcgi”,
“mod_h264_streaming”,
“mod_flv_streaming”,
“mod_rewrite”,
“mod_auth”,
)
h264-streaming.extensions = ( “.mp4” )
flv-streaming.extensions = ( “.flv” )

7. Setup vhost
There’re many samples out there for this part already, so I won’t write any here.

8. FCGI
I had FCGI installed in advance. To have lighttpd uses FCGI, edit

conf.d/fastcgi.conf

fastcgi.server = (
“.php” =>
(( “host” => “127.0.0.1”,
“port” => 81,
“bin-path” => “/usr/local/bin/php”
)),
)
9. restart lighttpd
Then you can see the lighttpd started fcgi process

10. Use jwplayer
download mediaplayer.zip
unzip it and copy “jwplayer.js” and “player.swf” to a folder under docroot of the site
check the “JW Player Quick Start Guide.pdf” in the zip file for how to use javascript to embed jwplayer to stream.

Leave a Reply

Your email address will not be published.