Lighttpd with mod_h264 streaming (mp4)

This short tutorial explains you how to install Lighttpd web server with mod_h264 (mp4) support with the current latest versions. I have tested it in panel and panel free servers and all seems to be working fine without any compilation errors. If you encounter with any errors, feel free to contact me.


Downloading tar files


Let us download the latest “Lighttpd source code” from the lighttpd official website (you must be login as root to perform the below operations)



Then, we download “lighttpd h264 streaming module” from website.



Patching the h264 module


Untar the “lighttpd source code” tar file


  • # tar -xzf lighttpd-1.4.26.tar.gz


This is the part that we change “lighttpd source code directory” (lighttpd-1.4.29) to “lighttpd-1.4.18” so when we will untar “lighttpd h264 streaming module” the module will patch itself.


  • # mv lighttpd-1.4.29 lighttpd-1.4.18


Now untar the “lighttpd h264 streaming module”

  • # tar -xzf lighttpd-1.4.18_mod_h264_streaming-2.2.9.tar.gz


Go to the directory of the source code and run script to generate all the initial makefiles.


  • # cd lighttpd-1.4.18
    # ./
    # ./configure


Compiling and install the source to binary (it’s recommended to stop lighttpd if it’s running right now).


  • # make && make install

Make sure no error is spitting out during the make and make install process.


Configuring lighttpd to support h264


After that, you need to configure lighttpd to support h264 streaming and restart lighttpd.


Sample Vhost entry for lighttpd :


$HTTP[“host”] !~ “^(domain1\.org|test2\.example\.org)$” {
simple-vhost.server-root = “/var/www”
simple-vhost.document-root = “/html/”
## the default host if no host is sent
simple-vhost.default-host = “”

$HTTP[“host”] == “” {
server.document-root = “/home/user/sites/”
accesslog.filename = “/home/user/sites/logs/”

$HTTP[“host”] == “” {
server.document-root = “/home/user/sites/”
accesslog.filename = “/home/user/sites/logs/”


Enabling the flv Streaming Support


Un-comment the mod_flv_streaming & mod_secdownload in the lighttpd.conf file.

  • server.modules = ( 
     "mod_secdownload", ## optional
  • flv-streaming.extensions = ( ".flv" )

For Secdownload module add the below lines within the above virtualhost entry.


  • secdownload.secret          = "vAfddsv4$%4"
    # If video folder location is "/var/www/vhosts/" then
    secdownload.document-root   = "/var/www/vhosts/"
    secdownload.uri-prefix      = "/flv/" 
    secdownload.timeout         = 36000


To Enable Mp4 Support (Lighttpd should be installed as specified in the above format). This module does not come with the lighttpd rpm.


  • server.modules = ( 
  • h264-streaming.extensions = ( ".mp4" )


Restart the lighttpd service to load the new settings.