Project

General

Profile

TutorialLighttpdAndPHPAndTrac » History » Revision 4

Revision 3 (Anonymous, 2006-08-23 22:33) → Revision 4/6 (Anonymous, 2006-08-23 22:33)

h2. == Setting up PHP with Lighttpd and trac 


 == 

 If you want to serve php pages and restrict user's access to view their code or accidentally download them, but run a service that displays source of php pages (such as trac) at the same time, it can be done as shown below. 





 



 [[BR]] 
 Enable fastcgi to serve normal site pages. 

 <pre> 

 
 {{{ 
 fastcgi.server = ( ".php" => (( 
                      "bin-path" => "/usr/local/bin/php", 
                      "socket" => "/tmp/php-fastcgi.socket", 
                      "max-procs" => 2, 
                      "bin-environment" => (  
                        "PHP_FCGI_CHILDREN" => "16", 
                        "PHP_FCGI_MAX_REQUESTS" => "10000" 
                      ), 
                      "bin-copy-environment" => ( 
                        "PATH", "SHELL", "USER" 
                      ), 
                      "broken-scriptfilename" => "enable"))) 
 </pre> 






 }}} 



 [[BR]] 
 Run fastcgi for trac only when the trac area of the site is in use. 

 <pre> 

 
 {{{ 
 $HTTP["url"] =~ "^/trac" { 
 fastcgi.server = ( "/trac" => 
                    ("trac" => 
                      ("socket" => "/tmp/trac-fastcgi.sock", 
                       "bin-path" => "<path to trac>/cgi-bin/trac.fcgi", 
                       "check-local" => "disable", 
                       "bin-environment" => ("TRAC_ENV" => "<path to trac project environment>") 
                      ) 
                    )) 
 } 
 </pre> 





 }}} 


 [[BR]] 
 Source files in trac are usually in "/trac/browser/trunk", but change accordingly. 
 With the following conditional we assure that access is restricted to php pages, except when we browse the source repository. 

 <pre> 

 
 {{{ 
 $HTTP["url"] !~ "^/trac/browser/trunk/" { 
      url.access-deny = (".php") 
 } 
 </pre> 



 }}} 


 You might also want to check out [[HowToSetupTrac]]. 
 [HowToSetupTrac].