Project

General

Profile

Docs ModProxyCore » History » Revision 3

Revision 2 (jakabosky, 2006-12-12 22:45) → Revision 3/51 (jakabosky, 2006-12-12 22:53)

{{{ 
 #!rst  

 =================== 
 the Proxy Interface 
 =================== 

 ---------------------- 
 Module: mod_proxy_core 
 ---------------------- 

 .. contents:: Table of Contents 


 Description 
 =========== 

 ... 

 Options 
 ======= 

 lighttpd provides the Proxy support via the proxy-module  
 (mod_proxy_core) (mod_proxy) which provides the following 3 options in the config-file: 

 :proxy-core.balancer: :proxy.debug: 
   a value between 0 and 65535 to set the debug-level in the  
   Proxy module. Currently only 0 and 1 are used. Use 1 to  
   enable some debug output, 0 to disable it.Note:Use 'enable|disable' in v1.4.13. 

 :proxy.balance: 
   might be one of 'round-robin', 'sqf' 'hash', 'round-robin' or 'carp'. 

 :proxy-core.protocol: 'fair' (default). 
  
   'round-robin' chooses another host for each request, 'hash' 
   might be one is generating a hash over the request-uri and makes sure 
   that the same request URI is sent to always the same host. 
   That can increase the performance of 'http', 'fastcgi' or 'scgi'. the backend servers 
   a lot due to higher cache-locality. 'fair' is the normal 
   load-based, passive balancing. 

 :proxy-core.backends: :proxy.server: 
   tell the module where to send Proxy requests to. Every  
   file-extension can have its own handler. Load-Balancing is  
   done by specifying multiple handles for the same extension. 
  
   structure of proxy.server section: :: 
  
     ( <extension> =>  
       (  
         ( "host" => <string> , 
           "port" => <integer> ), 
         ( "host" => <string> , 
           "port" => <integer> ) 
       ), 
       <extension> => ...  
     ) 

   :<extension>: is the file-extension or prefix (if started with "/") 
                 might empty to match all requests 
   It :"host":        is a list ip of hostname/ip address/unix-domain socket the proxy server 
   :"port":        is tcp-port on the "host" used by the proxy 
                 server (default: 80) 

   e.g.: :: 
  
     proxy.server = ( ".jsp" => 
                        ( (  
                            "host" => "10.0.0.242", 
                            "port" => 81 
                          ) ) 
                      ) 

 Example: 
 ======== 

 Using lighttpd + mod_proxy_core in front of 8 Squids which handle the  
 caching of dynamic content for you. All requests for the host  
 www.example.org should be forwarded to the proxy. All proxies 
 listen on port 80 for requests. :: 

   $HTTP["host"] == "www.example.org" { 
     proxy-core.protocol = "http" 
     proxy-core.balancer = "sqf" 
     proxy-core.rewrite-request = ( 
         "Host" => ( ".*" => "www.example.org" ) 
     ) 
     proxy-core.backends = ( "10.0.0.10", 
                             "10.0.0.11", 
                             "10.0.0.12", 
                             "10.0.0.13", 
                             "10.0.0.14", 
                             "10.0.0.15", 
                             "10.0.0.16", 
                             "10.0.0.17" ) 
   } 

 If one of the hosts goes down the all requests for this one server are  
 moved equally to the other servers. If you want to know more about 
 the algorithm used here google for 'Microsoft CARP'. 

 for php :: 

   $HTTP["url"] =~ "\.php$" { 
     proxy-core.balancer = "round-robin" 
     proxy-core.protocol = "fastcgi" 
     proxy-core.check-local = "enable" 
     proxy-core.backends = ( "127.0.0.1:1026" ) 
     proxy-core.max-pool-size = 16 
   } 

 }}}