Project

General

Profile

Mod cgi » History » Revision 12

Revision 11 (Anonymous, 2008-05-03 05:47) → Revision 12/31 (nitrox, 2008-11-04 23:23)

h1. The CGI-Module [[TracNav(DocsToc)]] 

 <pre> 

 #!rst 
 === 
 CGI 
 === 

 *Module: mod_cgi* --------------- 
 Module: mod_cgi 
 --------------- 
  
 .. meta:: 
   :keywords: lighttpd, cgi 
  
 .. contents:: Table of Contents 

 {{>toc}} 


 h2. Description 
 =========== 

 CGI programs allow you to enhance the functionality of the server in a very 
 straight-forward and simple way. 


 h2. 

 Options 


 *cgi.assign* 
 ======= 

 cgi.assign 

   file-extensions that are handled by a CGI program 

 <pre> 
     

   e.g.: :: 
  
     cgi.assign = ( ".pl"    => "/usr/bin/perl", 
                    ".cgi" => "/usr/bin/perl" ) 
 </pre> 

 

   For PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini. 

 

   To get the old cgi-bin behavior of apache: 

 <pre> 
     :: 

     #Note: make sure that mod_alias is loaded if you use this: 
     alias.url += ( "/cgi-bin" => server_root + "/cgi-bin" ) 
     $HTTP["url"] =~ "^/cgi-bin" { 
         cgi.assign = ( "" => "" ) 
     } 
 </pre> 

 *cgi.execute-all* cgi.execute-all 

   In 1.5.0 and later you can use: :: 

 <pre> 
     
   
     $PHYSICAL["existing-path"] =~ "^/var/www/myvhost/cgi-bin/" { 
       cgi.execute-all = "enable" 
     } 
 </pre> 

  

   which does the same thing as cgi.assign = ("" => "") but is more obvious to use. 
 
 h2. Examples 
 ======== 

 To setup an executable which can run on its own (e.g. binaries, scripts  
 with a shebang line) you just don't specify a handler for the extension: 

 <pre> 
   :: 

   cgi.assign = ( ".sh" => "" ) 
 </pre> 
  
 If the file has no extension keep in mind that lighttpd matches not the 
 extension itself but the right part of the URL: 

 <pre> 
   :: 

   cgi.assign = ( "/testfile" => "" ) 
 

 </pre>