[Catalyst] Lighttpd and fastcgi

Daisuke Murase typester at cpan.org
Fri Jan 20 19:02:38 CET 2006


Hmm. I have setting shows below when cat app on web-server root:

    $HTTP["host"] == "myapp.example.com" {
        server.document-root = "/path/to/MyApp"
    
        $HTTP["url"] =~ "^/" {
            setenv.add-environment = ( "SCRIPT_NAME" => "/" )
        }
    
        url.rewrite-once = (
            "^/((?:js/|css/|image/|static/).*)" => "/root/$1",
            "^/(?!js/|css/|image/|static/)(.*)" => "/script/myapp_fastcgi.pl/$1"
        )
    
        fastcgi.server = (
            "/script/myapp_fastcgi.pl" => (
                "myapp" => (
                    "socket"    => "/tmp/myapp.socket",
                    "bin-path"  => "/path/to/MyApp/script/myapp_fastcgi.pl",
                    "min-procs" => 1,
                    "max-procs" => 1,
                    "idle-timeout" => 20,
                )
            )
        )
    }


Yes, I know it's a bit verbose..
But I think this sample may helps you, so wrote it :)

--
Daisuke Murase <typester at cpan.org>


Nigel Metheringham <nigel.metheringham at dev.intechnology.co.uk> wrote:
> On Fri, 2006-01-20 at 21:35 +0900, Daisuke Murase wrote:
> > I'm using mod_setenv module for this problem.
> > 
> > example:
> > 
> >     $HTTP["url"] =~ "^/myapp/" {
> >         setenv.add-environment = ( "SCRIPT_NAME" => "/myapp/" )
> >     }
> > 
> > With this config, you can see $c->req->base is 'http://.../myapp/'
> > under /myapp/ path.
> 
> Thats making base work... at the price of breaking everything else :-)
> 
> It appears that (for my app at the root of the web server), the values
> passed should look something like:-
>   SCRIPT_NAME = '/'
>   PATH_INFO = '/useradmin/chpass'
> 
> Whats happening instead is that I'm getting this:-
>   SCRIPT_NAME = '/useradmin/chpass'
>   PATH_INFO = 
> 
> Now forcing SCRIPT_NAME to / is causing the useful data that should be
> in PATH_INFO to be lost.
> 
> [later...]
> 
> OK, have worked out *whats* wrong.
> It all goes wrong if you have your cat app at the webserver root, so my
> fastcgi config stanza looked like:-
> 
> 
>         fastcgi.server             = (
>            "" => (
>               "MyApp" => (
>                  "socket"       => "/tmp/MyApp.socket",
>                  "check-local"  => "disable",
>                  "bin-path"     => "/usr/share/myapp/script/myapp_fastcgi.pl",
>                  "min-procs"    => 1,
>                  "max-procs"    => 3,
>                  "idle-timeout" => 20
>               )
>            )
>         )
> 
> Putting it at another part of the url namespace makes it work OK -
> without any SCRIPT_NAME hacking required:-
> 
>         fastcgi.server             = (
>            "/app" => (
>               "MyApp" => (
>                  "socket"       => "/tmp/MyApp.socket",
>                  "check-local"  => "disable",
>                  "bin-path"     => "/usr/share/myapp/script/myapp_fastcgi.pl",
>                  "min-procs"    => 1,
>                  "max-procs"    => 3,
>                  "idle-timeout" => 20
>               )
>            )
>         )
> 
> 
> 	Nigel.
> 
> -- 
> [ Nigel Metheringham           Nigel.Metheringham at InTechnology.co.uk ]
> [ - Comments in this message are my own and not ITO opinion/policy - ]
> 
> 
> 
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst
> 
n



More information about the Catalyst mailing list