Lighttpd is a free web server designed for speed, with all the essential functions of a web server.  The low memory footprint (compared to other web servers) small CPU load and speed optimizations make lighttpd suitable for servers that are suffering load problems, or for serving static media separately from dynamic content. You can install lighttpd as reverse proxy with apache web server.

lighttpd

We can now setup lighttpd as reverse-proxy for apache.

How to install Lighttpd for FLV streaming

find lighttpd rpm repository

http://pkgs.repoforge.org/lighttpd/

or

yum install lighttpd

vi /etc/lighttpd/lighttpd.conf

change lighttpd port to 81
 server.port = 81
 server.use-ipv6 = "disable"

server.username  = "nobody"
 server.groupname = "nobody"

touch /var/log/lighttpd/error.log
touch /var/log/lighttpd/access.log

chown -R nobody.nobody /var/log/lighttpd

/etc/init.d/lighttpd restart

When you get restart error like this errors then check with log file permissions.

Starting lighttpd: (log.c.118) opening errorlog ‘/var/log/lighttpd/error.log’ failed: Permission denied
vi /etc/lighttpd/modules.conf

make sure modules and including these for flv steaming…

include “conf.d/simple_vhost.conf”
include “conf.d/flv_streaming.conf”

include ” conf.d/secdownload.conf”

vi conf.d/simple_vhost.conf

example entry

$HTTP[“host”] =~ “(^|\.)www.lighttpdexample\.com:81$” {
server.document-root = “/home/cpanel/public_html/”
secdownload.secret          = “vAfddsv4$%4”
secdownload.document-root   = “/home/cpanel/public_html/media/videos”
secdownload.uri-prefix      = “/flv/”
secdownload.timeout         = 36000
flv-streaming.extensions = ( “.flv” )
h264-streaming.extensions = ( “.mp4” )
}

or

$HTTP[“host”] != “^(fotoblow.tamilcomedy\.info)$” {
simple-vhost.server-root = “/home/username/public_html/”
simple-vhost.default-host = “fotoblow.tamilcomedy.info”
simple-vhost.document-root = “fotoblow”
}

$HTTP[“host”] =~ “(^|\.)fotoblow.tamilcomedy\.info:81$” {
server.document-root = “/home/username/public_html/fotoblow/”
}
$HTTP[“host”] =~ “(^|\.)www.cpanelkb\.net:81$” {
server.document-root = “/home/username/public_html/fotoblow/”
}
$HTTP[“host”] =~ “(^|\.)tamilcomedy\.info:81$” {
server.document-root = “/home/username/public_html/fotoblow/”
}

 

Then enable steaming modules.

vi conf.d/flv_streaming.conf

server.modules += ( “mod_flv_streaming”)
flv-streaming.extensions = ( “.flv” )

Normally apache will running on port 80, these entries will redirect .flv extension to port 81. Add the following code in your apache configuration.

vi /etc/httpd/conf/httpd.conf

Add the following entries blow domain config

ProxyPassReverse / http://%{HTTP_HOST}:81/
RewriteEngine on
RewriteCond   %{REQUEST_URI} .*\.(gif|png|jpg|flv|mp4|mp3)$
RewriteRule ^/(.*) http://%{HTTP_HOST}:81/$1 [P]

That’s all !!!

 

Now restart apache webserver and check your lighttpd access logs /var/log/lighttpd/access.log.

 

Get Free cPanel Knowledge Base

Thank you for subscribing.

Something went wrong.

5.00 avg. rating (97% score) - 2 votes