Fast cgi and form values

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


This is probably a stupid question but anyway here it

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

Nginx configuration:
location ~ .cgi$ {
  fastcgi_index index.cgi;
  fastcgi_param SCRIPT_FILENAME
  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} &&
            print($output) if $output;



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


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