[Catalyst] nginx/FastCGI configuration issues

Jesse Sheidlower jester at panix.com
Wed Feb 15 17:02:41 GMT 2012

Executive summary: new deployment on nginx 1.0.5 and FastCGI; my
Catalyst apps are in non-root locations. When I go to the base, e.g.
http://mysite.com/incomings, $c->req->uri thinks I'm at
http://mysite.com/incomings//incomings. This is causing problems with

I'm in the process of moving a physical server to a VM in EC2, and have
taken the opportunity to move my Cat apps from Apache/mod_perl to
nginx/FastCGI. The latter combination is proving to be vastly faster.
The server is running Ubuntu 11.10, and nginx 1.0.5.

I am having one issue that I can't resolve, however. When I first visit
an app at its root, e.g. http://mysite.com/incomings, I get redirected
over SSH to https://mysite.com/incomings/login. After successful login I
am then returned to http://mysite.com/incomings//incomings. A bunch of
testing and logging has revealed that when I first hit the site,
$c->req->uri thinks that I'm at http://mysite.com/incomings//incomings,
so the redirect is indeed going to where it thinks it originally was.

After this first login, things work fine, so that if I manually go to
http://mysite.com/incomings/ everything ends up OK for continuing use of
the app. 

I have a separate nginx configuration file for each Cat app, and they
look more or less like this:
       location /incomings {
           include fastcgi_params;
           fastcgi_param SCRIPT_NAME /incomings/;
           fastcgi_param PATH_INFO $fastcgi_script_name;
           fastcgi_pass   unix:/tmp/incomings.socket;

       location /incomings/static {
                    alias /usr/local/www/modules/Incomings/root/static;

I tried to follow the docs (at C::M::Deployment::nginx::FastCGI)
exactly, and if I'm doing something wrong, I'm not clear what it is.

I'd be very grateful for any suggestions for how to solve this, as this
is the one thing preventing the server from going live! Thanks.

Jesse Sheidlower

More information about the Catalyst mailing list