[Catalyst] Problems With FastCGI

Bill Moseley moseley at hank.org
Fri Feb 3 20:19:40 CET 2006


On Fri, Feb 03, 2006 at 10:53:07AM -0500, hkclark at gmail.com wrote:
> Here are all the FastCGI parts of the apache config:
> 
>   LoadModule fastcgi_module modules/mod_fastcgi.so
> 
>   #FastCgiIpcDir /tmp/fcgi_ipc/
>   FastCgiIpcDir /tmp
>   AddHandler fastcgi-script .fcgi
> 
>   # Serve static content directly
>   DocumentRoot  /var/www/apps/tutorial/root
>   Alias /static /var/www/apps/tutorial/root/static
> 
>   FastCgiServer /var/www/apps/tutorial/script/tutorial_fastcgi.pl -processes
> 1
>   Alias /tutorial/ /var/www/apps/tutorial/script/tutorial_fastcgi.pl/
> 
>   # Or, run at the root
>   Alias / /var/www/tutorial/script/tutorial_fastcgi.pl/

Probably doesn't matter, but pick one or the other.

> I was wondering about the .pl extension causing it to run as a "normal CGI"
> vs FastCGI, so I made a copy of the tutorial_fastcgi.pl into
> tutorial_fastcgi.fcgi and also tried this in httpd.conf:

That's one reason I always use a new httpd.conf file.  Here's a
complete session:

Create the application:

    moseley at bumby:~$ catalyst.pl Tutorial
    created "Tutorial"
    [...]

    moseley at bumby:~$ cd Tutorial/


Apache config:

    moseley at bumby:~/Tutorial$ cat httpd.conf

    LoadModule alias_module /usr/lib/apache/1.3/mod_alias.so
    LoadModule fastcgi_module /usr/lib/apache/1.3/mod_fastcgi.so

    ServerName localhost
    ErrorLog error_log
    PidFile httpd.pid
    Port 3003
    FastCgiServer script/tutorial_fastcgi.pl -processes 3 -socket /tmp/tutorial
    Alias / /home/moseley/Tutorial/script/tutorial_fastcgi.pl/

Note that I specify the socket -- otherwise it will try and create it
in the default location (logs/..) which I didn't create.


Start Apache:  (the -X is just for this example, of course)


    moseley at bumby:~/Tutorial$  /usr/sbin/apache -d $(pwd) -f httpd.conf -X


Make a request:


    moseley at bumby:~/Tutorial$ GET http://localhost:3003/ | grep '<title>'
            <title>Tutorial on Catalyst 5.63</title>


-- 
Bill Moseley
moseley at hank.org




More information about the Catalyst mailing list