Lighttpd is a free web server designed for speed, with all the essential functions of a web server. It has low memory footprint as compared to other web servers and 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.
We can now setup lighttpd for apache proxy.
yum install lighttpd & also install mod_flv_streaming
To compile from source code see the link :-
http://thelinuxguru.blogspot.in/2008/10/how-to-compile-lighttpd-on-centos.htmlvim /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
vim /etc/lighttpd/modules.conf
make sure modules are including these for flv steaming…
include “conf.d/simple_vhost.conf”
include “conf.d/flv_streaming.conf”
vim conf.d/simple_vhost.conf
example entry
$HTTP["host"] != “^(footage.example\.info)$” {
simple-vhost.server-root = “/home/username/public_html/”
simple-vhost.default-host = “footage.example.info”
simple-vhost.document-root = “footage”
}
$HTTP["host"] =~ “(^|\.)footage.example\.info:81$” {
server.document-root = “/home/username/public_html/footage/”
}
$HTTP["host"] =~ “(^|\.)www.example2\.net:81$” {
server.document-root = “/home/username/public_html/footage/”
}
$HTTP["host"] =~ “(^|\.)example3\.info:81$” {
server.document-root = “/home/username/public_html/footage/”
}
Then enable steaming modules.
vim 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.vim /etc/httpd/conf/httpd.conf
Add the following entries below 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]
Now restart apache webserver and check your lighttpd access logs /var/log/lighttpd/access.log.