Home > Slackware > Slackware 12.2 lighttpd-1.5.0-r1992 http sqf balanacing , php spawn-fcgi and nagios-2.3.1

Slackware 12.2 lighttpd-1.5.0-r1992 http sqf balanacing , php spawn-fcgi and nagios-2.3.1

I discovered lighttpd several months ago, and just recently had chance to implement it as http proxy balancer for a group of 4 DL3205Gp boxes.
I started with the 1.4.3, but  finished with 1.5.0-r1992 …
All the boxes has lighty and Apache running, I have one box as http proxy  balancing the rest, and in case its dead, one of the resting three will become the loadbalancer.  The balancing is done via lighttpd 1.5 and its mod_proxy_core and mod_proxy_backend_http modules.
Have to say, I use one of the boxes as NFS server,  and the resting three  mount the webserver directory in a view to serve the same contect …
The tricky part was to bypass the nagios url from balancing, for abious reasons.
The trick: in lighttpf.conf
$HTTP[“url”] !~ “\.(js|css|gif|jpg|png|ico|txt|swf|html|htm)$|^\/(nagios|nagadmin)” {
#$HTTP[“url”] =~ “\.php$” {
proxy-core.protocol = “http”
proxy-core.balancer = “sqf”
proxy-core.allow-x-sendfile = “enable”
proxy-core.backends = (
#  lighty pool
# dont use the box “127.0.0.1:80”
“10.99.99.11:80″
,”192.168.11.12:80″
,”192.168.11.13:80″
#  APACHE pool
#  dont use apache at the hosting box …,”127.0.0.1:8800″
,”10.99.99.11:8800″
,”192.168.11.12:8800″
,”192.168.11.13:8800”

)
proxy-core.max-pool-size = 3000
}

in the light we have include of nagios.conf:
alias.url =     (
“/nagios/cgi-bin” => “/usr/local/nagios/sbin”,
“/nagios” => “/usr/local/nagios/share”
)

$HTTP[“url”] =~ “^/nagios/cgi-bin” {
cgi.assign = ( “” => “” )
}

$HTTP[“url”] =~ “nagios” {
auth.backend = “htpasswd”
auth.backend.htpasswd.userfile = “/etc/nagios/.htpasswd”
auth.require = ( “” => (
“method” => “basic”,
“realm” => “Monitoring area”,
“require” => “valid-user”
)
)
setenv.add-environment = ( “REMOTE_USER” => “user” )
$HTTP[“url”] =~ “\.php$” {
proxy-core.balancer = “round-robin”
proxy-core.protocol = “fastcgi”
proxy-core.allow-x-sendfile = “enable”
proxy-core.backends = ( “unix:/tmp/php-fastcgi.sock”)
proxy-core.max-pool-size = 16
}
}

In this way the nagios url is handled by the local box only.
same settings will be for interna box, but using the proxy-core http protocol  instead …

At the end, I would like to thank Carlos Silva Santin for giving me  the chance to wotk with him in the past 30 days ..
Carla  will grow up so fast Carlos … :p

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: