r7 - 29 Oct 2007 - 06:53:35 - GilmarSantosJrYou are here: TWiki >  Codev Web > TWikiOn > TWikiOnLighttpd > TWikiOnLighttpdUsingFastCgi
Tags:
installation 1 Add my vote for this tag, , create new tag

TWiki on lighttpd using FastCgi

For information on running TWiki on Lighttpd, see TWikiOnLighttpd.

I have been investigating the use of FastCGI rather than plain CGI to run TWiki.

For this initial test, I have set up the default view script to run as a CGI, and a modified view script 'viewd.pl' to run as a FastCGI service.

Execute view.pl as CGI

$HTTP["url"] =~ "^/twiki/bin/" {
    # disable directory listings
    dir-listing.activate = "disable"
    # only allow cgi's in this directory
    cgi.assign = (
      "view.pl"    =>    "/usr/bin/perl"
   )
}

Run viewd.pl as a FastCGI service

fastcgi.server = ( ".pl" =>
                     ( "localhost" =>
                         (
                             "host"      => "127.0.0.1",
                             "port"      => 1026,                                       
                             "bin-path"  => "/var/www/localhost/htdocs/twiki/bin/viewd.pl"
                         )
                     )
                 )

The viewd.pl script

#!/usr/bin/perl -w
# Note that, for the moment, the -T flag is not set.
#
# TWiki Enterprise Collaboration Platform, http://TWiki.org/
#
# Copyright (C) 1999-2006 Peter Thoeny, peter@thoeny.org
# and TWiki Contributors.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version. For
# more details read LICENSE in the root of this distribution.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# As per the GPL, removal of this notice is prohibited.

use CGI::Fast qw(:standard);

BEGIN {
    # Set default current working directory (needed for mod_perl)
    if( $ENV{"SCRIPT_FILENAME"} && $ENV{"SCRIPT_FILENAME"} =~ /^(.+)\/[^\/]+$/ ) {
        chdir $1;
    }
    # Set library paths in @INC, at compile time
    unshift @INC, '.';
    require 'setlib.cfg';
}

while (new CGI::Fast) {

use TWiki::UI::View;
TWiki::UI::run( \&TWiki::UI::View::view );

}

Benchmarks

Using 'ab2' (Apache Bench), the Main WebHome is requested 200 times, with two different concurrency settings.

5 concurrent users

lighttpd_cgi_5.png

30 concurrent users

lighttpd_cgi_30.png

-- Contributors: StefanHaflidason

Notes

  • An aspect of this setup which I find interesting is the apparent ease with which the view script (or another) could be run on a separate server.

-- Contributors: StefanHaflidason - 09 Aug 2006

Discussion

Thanks Stefan for contributing this doc. I renamed the topic as suggested. I also added you to the TWikiCommunityGroup so that you can also rename content. Please review what you can/should do in the group topic and use this additional priviledge responsibly.

-- PeterThoeny - 10 Aug 2006

Thank you, Peter. I'll do what I can to help.

-- StefanHaflidason - 11 Aug 2006

Hello! You did execute view.pl as cgi cgi.assign = ( "view.pl" => "/usr/bin/perl" )

Well on apache it was no problem to use view.pl without Extension. How can i do that with lighttpd.

Is there somethin like ScriptAlias ? I was searchin for a long time but didnt find a solution.

Thanks

-- GeorgSauseng - 12 Oct 2007

Some time ago I started TWikiStandAlone project, and I've just released its first version. There is native support for FastCGI and I wrote some configuration tips to use it with Lighttpd.

Georg, if you use:

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

You get similar behavior of Apache's ScriptAlias directive. More info: http://trac.lighttpd.net/trac/wiki/Docs%3AModCGI

-- GilmarSantosJr - 29 Oct 2007

 
Topic attachments
I Attachment Action Size Date Who Comment
pngpng lighttpd_cgi_30.png manage 6.5 K 09 Aug 2006 - 22:29 StefanHaflidason Comparison of CGI vs. FastCGI on Lighttpd with 30 concurrent users.
pngpng lighttpd_cgi_5.png manage 6.7 K 09 Aug 2006 - 22:29 StefanHaflidason Comparison of CGI vs. FastCGI on Lighttpd with 5 concurrent users.
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r7 < r6 < r5 < r4 < r3 | More topic actions
Codev.TWikiOnLighttpdUsingFastCgi moved from Codev.FastCgiOnLighttpd on 10 Aug 2006 - 20:55 by PeterThoeny - put it back
 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback SourceForge.net Logo