Fast cgi and form values

tom wang tomawng at yahoo.fr
Tue Jun 12 11:59:46 MSD 2007


Hi,

This is probably a stupid question but anyway here it
goes.

I have an old perl cgi program that I need to make
work with nginx. I don't want to modify the program in
question (it was programed by somebody else and is one
of those completely unreadable perl program).

To try to use it with nginx I tried to do the
following after reading
http://wiki.codemongers.com/NginxSimplePerlCGI

Nginx configuration:
location ~ .cgi$ {
  fastcgi_pass  127.0.0.1:1025;
  fastcgi_index index.cgi;
  fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
  fastcgi_param  DOCUMENT_ROOT    $document_root;
  fastcgi_param  QUERY_STRING     $query_string;
  fastcgi_param  REQUEST_METHOD   $request_method;
  fastcgi_param  CONTENT_TYPE     $content_type;
  fastcgi_param  CONTENT_LENGTH   $content_length;
 
  fastcgi_param  REQUEST_URI        $request_uri;
  fastcgi_param  DOCUMENT_URI       $document_uri;
  fastcgi_param  DOCUMENT_ROOT      $document_root;
  fastcgi_param  SERVER_PROTOCOL    $server_protocol;

  fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
  fastcgi_param  SERVER_SOFTWARE    nginx;

  fastcgi_param  REMOTE_ADDR        $remote_addr;
  fastcgi_param  REMOTE_PORT        $remote_port;
  fastcgi_param  SERVER_ADDR        $server_addr;
  fastcgi_param  SERVER_PORT        $server_port;
  fastcgi_param  SERVER_NAME        $server_name;
}

and I use the following perl script started with
spawn-fcgi from lighttpd:

#use CGI::Fast;
use FCGI;

END() { } BEGIN() { }
*CORE::GLOBAL::exit = sub { die
"fakeexit\nrc=".shift()."\n"; }; eval q{exit}; if ($@)
{ exit unless $@ =~ /^fakeexit/; } ;


sub mainloop() {
    while (FCGI::accept() >= 0) {
            my $output = `cd $ENV{DOCUMENT_ROOT} &&
perl $ENV{SCRIPT_FILENAME} 2>&1`;
            print($output) if $output;

    }
}

mainloop();


I know it's evil and it's completely annihilating the
point of using fastcgi but well....

Now it seemed to work fine, but after more testing, I
found out that, while  get parameters are passed
through the request_url environment variable, the form
values are not passed.
Is there anyway to solve this, did I forget to set an
environment variable in my nginx configuration file?

Thanks a lot, and sorry if the questions is too stupid
Regards,
Tom


     
_____________________________________________________________________________

Ne gardez plus qu'une seule adresse mail ! Copiez vos
mails vers Yahoo! Mail 


      _____________________________________________________________________________ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 





More information about the nginx mailing list