Welcome! Log In Create A New Profile

Advanced

perl fastcgi buffering problem

Stefan Parvu
March 14, 2010 01:54PM
Hi,

Im trying to see how certain Perl CGI scripts will
work on nginx. Im using nginx stable on Solaris 10
x86.

My configuration:

Perl CGI support: nginx-fcgi-0.4.3
http://www.nginx.eu/nginx-fcgi.html

nginx.conf:

location ~ ^/cgi-bin/.*\.cgi$ {
gzip off;
fastcgi_pass unix:/opt/sdr/report/ws/fastcgi_temp/nginx-fcgi.sock;
fastcgi_read_timeout 5m;
fastcgi_index index.cgi;
fastcgi_buffers 8 4k;
fastcgi_max_temp_file_size 0;
#
# You may copy and paste the lines under or use include directive
# include /etc/nginx/nginx-fcgi.conf;
# In this example all is in one file
#
fastcgi_param SCRIPT_FILENAME /opt/sdr/report/docroot/$fastcgi_script_name;
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 GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
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 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 a simple script which should output the stdout to browser:

##############################################################
use strict;

print "$ENV{SERVER_PROTOCOL} 200 OK\n";
print "Server: $ENV{SERVER_SOFTWARE}\n";
print "Content-type: text/plain\n\n";

print "Starting for...\n";
$|=1;

for (my $i = 1; $i <= 5; $i++) {
print "Iteration: $i\n";
sleep 1;
}

print "All done\n";

This example uses non-parsed headers, like old days for Apache < 1.x where
the server buffered the output of std CGI scripts. Passing:

print "$ENV{SERVER_PROTOCOL} 200 OK\n";
print "Server: $ENV{SERVER_SOFTWARE}\n";


should output directly to the browser the results, but it does not.
Found out about: fastcgi_max_temp_file_size but that did not help.

Any ideas how can I see immediately the results from a simple CGI
script in nginx/fcgi ?

thanks,
Stefan

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

perl fastcgi buffering problem

Stefan Parvu March 14, 2010 01:54PM

Re: perl fastcgi buffering problem

Stefan Parvu March 15, 2010 08:10AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 117
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready