question about Perl CGI

Francis Daly francis at
Wed Mar 30 17:13:51 MSD 2011

On Wed, Mar 30, 2011 at 09:21:40AM +0200, Yanxin Z. wrote:

Hi there,

> I am trying to integrate Nginx with Perl CGI script.
> I am following the How-TO

>         location ~ ^/cgi-bin/.*\.cgi$ {

> I put my cgi file in html/cgi_bin/print.cgi
> This cgi file will print out "Hello World!!"
> I start nginx, and visit 127/0.0.1/cgi_bin/print.cgi

> However, the web browser can not show "Hello World!!", instead, it will
> pop a download window, to ask me to download this cgi file.

You have configured to hand-to-fastcgi things below /cgi-bin.

You are requesting something below /cgi_bin. So it will be handled by
nginx, which will send you the file.

It probably sends it with Content-Type: application/octet-stream, which
a browser will frequently suggest you download.

If you try "curl -i"
you should see the details. Then after fixing it, "curl -i" should show you what you expect.

> I am thinking my conf is not correct. Could you help me to solve this
> issue?

- and _ are not the same

Good luck with it,

Francis Daly        francis at

More information about the nginx mailing list