nginx fastcgi configuration for CGI::Application app nginx fastcgi configuration for CGI::Application app nginx nginx

nginx fastcgi configuration for CGI::Application app


I maintain CGI::Application and also use Nginx. I have not done the same thing, but I would try this:

fastcgi_split_path_info ^(/index.pl)(.*)$;fastcgi_param PATH_INFO $fastcgi_path_info;fastcgi_param SCRIPT_NAME $fastcgi_script_name;

This is supposed to capture and forward the PATH_INFO that you need.

References:


I ended up solving the problem with a workaround in my C::A app. And I am documenting it here.

So I didn't managed to have nginx pass along the PATH_INFO down to my C::A app. To work around this, I set the PATH_INFO with the value of REQUEST_URI in my C::A app so it picks up the correct runmode.

Also, nginx isn't passing QUERY_STRING either so I had to append $query_string to the catch all route in order to pass along QUERY_STRING down as well.

my nginx config ends up like this:

server {    listen   80;    server_name example.com;    root /var/www/example.com/htdocs;    index  index.pl index.html;    location / {        try_files $uri $uri/ /index.pl?$query_string;    }    location ~ .*\.pl$ {            include fastcgi_params;   # this is the stock fastcgi_params file supplied in debian 6.0            fastcgi_index index.pl;            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;            fastcgi_param PERL5LIB "/var/www/example.com/lib";            fastcgi_param CGIAPP_CONFIG_FILE "/var/www/example.com/conf/my.conf";            fastcgi_pass unix:/var/run/fcgiwrap.socket;    }}