Could you, please, put this configuration and script on mason wiki at www.masonhq.com.
Thanks! Hyartep On 11/17/06, Jorge Valdes <[EMAIL PROTECTED]> wrote: > Gareth Kirwan wrote: > >> Recently I started using Lighttpd (http://www.lighttpd.net) to serve > >> FASTCGI applications, and was surprised to know that the Mason engine > >> can also be placed inside a FASTCGI wrapper and served with this web > >> server. Previously I had an old install using Apache 1.3.27, which I > >> converted to Lighttpd 1.4.13 and have seen speed improvements of up to > >> 400% when generating dynamic content. > > > > I've been tempted to play with lighttpd before, but haven't got around to it > > yet. > > What do you use in place of $r, and how is your mason handler set up? > > > > G > > > > > > I basically followed suggestions on the Lighttpd wiki, but here is my > config: > > ... > static-file.exclude-extensions += ( ".fcgi" ) > fastcgi.map-extensions = ( > "/" => ".html" > ,"autohandler" => ".html" > ,"dhandler" => ".html" > ) > fastcgi.server = ( > ".html" => > (( > "socket" => "/tmp/mason.sock", > "bin-path" => "/usr/local/supervise/lighttpd/mason.fcgi", > "check-local" => "disable", > "max-procs" => 3 > )) > ) > ... > > Please note that in my case, because I have limited RAM on the server, I > only start 3 fastcgi instances, but if you need to, you could setup as > many as your setup will allow (the default is 4 if you skip the > "max-procs" directive. > > Here is the handler (mason.fcgi): > > >>>BEGIN>>> > #!/usr/local/bin/perl > > #vim: et ts=4 sw=4 > > use strict; > > use HTML::Mason::CGIHandler; > > use CGI::Fast; > > > { > > package HTML::Mason::Commands; > # anything you want available to components > use DBI; > use lib qw( > /usr/local/rrdtool/lib/perl > /usr/local/mrtg-2/lib/mrtg2 > ); > use RRDs; > use MRTG_lib "2.090017"; > } > > # lazily-instantiated variables > my $cgi; > my $h; > > $ENV{MASON_COMP_ROOT} = '/home/mrtg/site'; > $ENV{MASON_DATA_ROOT} = '/home/mrtg/mason-prod'; > > while ($cgi = new CGI::Fast) { > > # this seems to be necessary as lighttpd does not provide the > # PATH_INFO and the QUERY_STRING environment variables > # Note that the below seems to work but I have no idea if it's > # the 'right' way to parse the REQUEST_URI out into > # PATH_INFO and QUERY_STRING > my $uri = $ENV{REQUEST_URI}; > if ($uri =~ /\?/) { > $uri =~ /^(.*?)\?(.*)/; > $ENV{PATH_INFO} = $1; > $ENV{QUERY_STRING} = $2; > } else { > $ENV{PATH_INFO} = $uri; > $ENV{QUERY_STRING} = ""; > } > > # this is lazily instantiated because %ENV is not set at startup time > if (! $h) { > $h = HTML::Mason::CGIHandler->new( > comp_root => $ENV{MASON_COMP_ROOT}, > data_dir => $ENV{MASON_DATA_ROOT}, > error_format => 'html', > allow_globals => [ qw($dbh %Users) ] > ); > } > > # hand off to mason > eval { $h->handle_cgi_object($cgi) }; > if (my $raw_error = $@) { > # print out a pretty system error page and log $raw_error > print $raw_error; > exit; > } > } > > exit 0; > <<<END<<< > > Jorge ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Mason-users mailing list Mason-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mason-users