[Catalyst] How to setup production Lighttpd and Catalyst apps...

Dustin Suchter dsuchter at ucla.edu
Wed Oct 17 06:24:03 GMT 2007


So I'm having a bit of a problem getting my app to run under
Lighttpd using FastCGI. Essentially my question is, "Can someone
explain how to set lighty, fastcgi, and my app up?" I've scoured
Google/Yahoo for more info but can't find a perl-FCGI specific
tutorial - just a PHP one. PHP fastcgi, for the record, is working
fine via lighty thanks to what I've found online. All the usual
software seems to be installed fine and happy (lighty, perl,
Catalyst, perl-FCGI...).

With the config below (which is my best guess after some
experimentation), I get the following when I try to start lighty:

[root at vanilla ~]# lighttpd -D -f /etc/lighttpd/lighttpd.conf
2007-10-16 22:04:38: (mod_fastcgi.c.1303) --- fastcgi spawning local
        proc:
/srv/www/vhosts/myapponline.com/htdocs/script/myapp_fastcgi.pl
        port: 3010
        socket
        min-procs: 4
        max-procs: 4
2007-10-16 22:04:38: (mod_fastcgi.c.1328) --- fastcgi spawning
        port: 3010
        socket
        current: 0 / 4
2007-10-16 22:04:38: (mod_fastcgi.c.999) execve failed for:
/srv/www/vhosts/myapponline.com/htdocs/script/myapp_fastcgi.pl
Permission denied
2007-10-16 22:04:38: (mod_fastcgi.c.1025) the fastcgi-backend
/srv/www/vhosts/myapponline.com/htdocs/script/myapp_fastcgi.pl
failed to start:
2007-10-16 22:04:38: (mod_fastcgi.c.1029) child exited with status
13 /srv/www/vhosts/myapponline.com/htdocs/script/myapp_fastcgi.pl
2007-10-16 22:04:38: (mod_fastcgi.c.1032) If you're trying to run
PHP as a FastCGI backend, make sure you're using the FastCGI-enabled
version.
You can find out if it is the right one by executing 'php -v' and it
should display '(cgi-fcgi)' in the output, NOT '(cgi)' NOR '(cli)'.
For more information, check
http://trac.lighttpd.net/trac/wiki/Docs%3AModFastCGI#preparing-php-as-a-fastcgi-programIf
this is PHP on Gentoo, add 'fastcgi' to the USE flags.
2007-10-16 22:04:38: (mod_fastcgi.c.1336) [ERROR]: spawning fcgi failed.
2007-10-16 22:04:38: (server.c.895) Configuration of plugins failed.
Going down.

Some other version and package info:

[root at vanilla ~]# lighttpd -v
lighttpd-1.4.18 (ssl) - a light and fast webserver
Build-Date: Oct 12 2007 13:28:05
[root at vanilla ~]# rpm -qa | grep -i perl
openssl-perl-0.9.7a-43.16
perl-Net-SSLeay-1.30-4.el4.centos
perl-DBI-1.40-8
perl-5.8.5-36.RHEL4
perl-Filter-1.30-6
perl-URI-1.30-4
perl-FCGI-0.67-1.c4
perl-DBD-MySQL-2.9004-3.1.centos4
[root at vanilla ~]#


Finally my lighty.conf:

    167 $HTTP["host"] =~ "www.myapponline.com" {
    168   server.dir-listing         = "enable"
    169   simple-vhost.server-root   = "/srv/www/vhosts/"
    170   simple-vhost.default-host  = "myapponline.com"
    171   simple-vhost.document-root = "/htdocs/"
    172
    173   # Let lighttpd take care of serving that static content
    174   alias.url = (
    175     "/favicon.ico" =>
"/srv/www/vhosts/myapponline.com/htdocs/root/favicon.ico",
    176     "/js/"         =>
"/srv/www/vhosts/myapponline.com/htdocs/root/src/js/",
    177     "/css/"        =>
"/srv/www/vhosts/myapponline.com/htdocs/root/src/css/",
    178   )
    179
    180   # rewrite-once will stop processing after the first match
    181  #url.rewrite-once = (
    182  #  "^/((?:js|css)/.*)" => "/$1",
    183  #  "^/favicon.ico" => "/favicon.ico",
    184  #  "^/(.*)" => "/fcgi/$1"
    185  #)
    186   fastcgi.debug = 1
    187   fastcgi.server = (
    188     ".pl" => (
    189       (
    190         "host" => "127.0.0.1",
    191         "port" => 3010,
    192         "check-local" => "disable",
    193         "bin-path" =>
"/srv/www/vhosts/myapponline.com/htdocs/script/myapp_fastcgi.pl"
    194       ),
    195       ( "host" => "127.0.0.1", "port" => 3011, "check-local"
=> "disable")
    196     )
    197   )
    198  #$HTTP["url"] =~ "^/" {
    199  #  setenv.add-environment = ( "SCRIPT_NAME" =>
"/script/myapp_fastcgi.pl" )
    200  #}
    201 }




More information about the Catalyst mailing list