Project

General

Profile

Docs ModProxyCore » History » Revision 8

Revision 7 (jakabosky, 2006-12-13 04:52) → Revision 8/51 (jakabosky, 2006-12-13 04:56)

{{{ 
 #!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) which provides the following options in the config-file: 

 proxy-core.balancer :proxy-core.balancer: 
   might be one of 'round-robin', 'sqf' or 'carp'. 

 proxy-core.protocol :proxy-core.protocol: 
   might be one of 'http', 'fastcgi' or 'scgi'.    Make sure you load the backend 
   modules (see mod_proxy_backend_http/mod_proxy_backend_fastcgi/mod_proxy_backend_scgi) 

 proxy-core.backends :proxy-core.backends: 
   tell the module where to send Proxy requests to. 
   It is a list of hostname/ip address/unix-domain socket 

 proxy-core.max-pool-size :proxy-core.max-pool-size: 
   max size for pool of connections to backends. 

 proxy-core.check-local :proxy-core.check-local: 
   enable checking for url file in local document-root.    Enable this for php 

 proxy-core.allow-x-sendfile :proxy-core.allow-x-sendfile: 
   enables use of "X-Sendfile/X-LIGHTTPD-Sendfile/X-LIGHTTPD-send-tempfile" heaers. 

 proxy-core.allow-x-rewrite :proxy-core.allow-x-rewrite: 


 proxy-core.rewrite-request :proxy-core.rewrite-request: 
   rewrite request headers or request uri. 

 proxy-core.rewrite-response :proxy-core.rewrite-response: 
   rewrite response headers. 

 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 = "carp" 
     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.allow-x-sendfile = "enable" 
     proxy-core.backends = ( "127.0.0.1:1026" ) 
     proxy-core.max-pool-size = 16 
   } 

 for SCGI :: 

   $HTTP["url"] =~ "\.scgi$" { 
     proxy-core.balancer = "round-robin" 
     proxy-core.protocol = "scgi" 
     proxy-core.check-local = "enable" 
     proxy-core.allow-x-sendfile = "enable" 
     proxy-core.backends = ( "127.0.0.1:9090" ) 
     proxy-core.max-pool-size = 16 
   } 

 for http-proxy with host and file-extension conditionals :: 

   $HTTP["host"] == "www.example.org" { 
     proxy-core.protocol = "http" 
     proxy-core.balancer = "carp" 
     $HTTP["url"] =~ "\.php$" { 
       proxy-core.backends = ( "10.0.0.10:80" ) 
     } 
     $HTTP["url"] =~ "\.scgi$" { 
       proxy-core.backends = ( "10.0.0.10:80" ) 
     } 
   } 

 Reverse-Proxying :: 

   $HTTP["url"] =~ "^/proxyme(/|$)" { 
     proxy-core.balancer = "round-robin" 
     proxy-core.protocol = "http"  
     proxy-core.backends = ( "en.wikipedia.org" ) 
     proxy-core.rewrite-response = ( 
       "Location" => ( "^http://en.wikipedia.org/(.*)" => "http://127.0.0.1:1025/proxyme/$1" ), 
     ) 
     proxy-core.rewrite-request = ( 
       "_uri" => ( "^/proxyme/?(.*)" => "/$1" ), 
       "Host" => ( ".*" => "en.wikipedia.org" ), 
     ) 
   } 

 }}}