Project

General

Profile

ApplicationsUsingLighttpd » History » Revision 13

Revision 12 (davojan, 2006-06-27 08:54) → Revision 13/34 (Anonymous, 2006-07-29 14:35)

= Applications Using lighttpd = 

 Lighttpd works nicely with most web-projects. To get them setup easily some are providing special lighttpd setups. 

  * [http://www.rubyonrails.org/ RubyOnRails] 
  * [http://drupal.org/node/20766 Drupal] 
  * [http://hieraki.simplicio.com/read/book/1 Lighttpd: The painless way] 
  * [http://wordpress.org/support/topic/27541 Wordpress] 
  * [http://laitsas.com/wordpress/3/rewrite-rules/ Wordpress with permalink structure] 
  * [http://trac.lighttpd.net/trac/wiki/TracInstall Trac] 
  * [http://article.gmane.org/gmane.comp.web.lighttpd/1752 Mailman] 
  * [http://bradchoate.com/weblog/2005/08/26/mt-32-and-lighttpd-fastcgi Moveable Type 3.2] 

 == Using a Perl dispatcher instead of mod_perl == 

 I just received a mail from Alex Shah <ashah@teamsoa.com>: 

 I thought you might like to include this in the distribution: 
 {{{ 
 #!perl 
 #!/usr/bin/perl 
 use strict; 
 use CGI::Fast; 
 use Embed::Persistent; 
 { 
     my $p = Embed::Persistent->new(); 
     while (new CGI::Fast) { 
         my $filename = $ENV{SCRIPT_FILENAME}; 
         my $package = $p->valid_package_name($filename); 
         my $mtime; 
         if ($p->cached($filename, $package, \$mtime)) 
         { 
             eval {$package->handler;}; 
         } 
         else 
         { 
             $p->eval_file($ENV{SCRIPT_FILENAME}); 
         } 
     } 
 } 

 Here's the lighttpd.conf: 

 fastcgi.server = ( ".pl" => 
     (( "socket"     => "/tmp/application.fcgi.socket", 
        "bin-path" => "/Users/ashah/docroot/dispatch.fcgi", 
     )) 
 ) 
 }}} 

 There is sometime problem to compile ExtUtils from CPAN which provide Embed::Persistent, so you can only download them and copy lib/Embed to your perl path. You can also find some info at [http://search.cpan.org/dist/perl/pod/perlembed.pod#Maintaining_a_persistent_interpreter]. 

 If the above does not work nicely for you maybe you can try [http://www.daemoninc.com/SpeedyCGI/ SpeedyCGI] which runs Perl scripts persistently through its own persistent Perl interpreter. It runs like an ordinary CGI and does not require any changes to your lighttpd setup (just change the shebang line in your script). [http://search.cpan.org/dist/perl/pod/perlembed.pod#Maintaining_a_persistent_interpreter] 

 == multiple RubyOnRails on one server == 

 http://wiki.rubyonrails.com/rails/show/HowtoDeployMoreThanOneRailsAppOnOneMachine describes this on Apache, here we do it on lighty: 

 {{{ 
 $HTTP["url"] =~ "^/appOne" { 
   url.rewrite = ( "^/appOne(/.*)$" => "/appOne/public$1" ) 
   fastcgi.server = ( "dispatch.fcgi" => (( "bin-path" ... ))) 
   server.error-handler-404 = "/appOne/dispatch.fcgi" 
 } 
 $HTTP["url"] =~ "^/appTwo" { 
   url.rewrite = ( "^/appTwo(/.*)$" => "/appTwo/public$1" ) 
   fastcgi.server = ( "dispatch.fcgi" => (( "bin-path" ... ))) 
   server.error-handler-404 = "/appTwo/dispatch.fcgi" 
 } 

 }}}