Nginx + Perl

Hi
Nginx perfectly execute Perl scripts with the extensions *.cgi or *.pl
(www.abc.com/bin/test_perl_script.cgi) via fastcgi.
But I should execute Perl scripts without the extension. For example:
www.abc.com/bin/test_perl_script
How to configure nginx.conf file.

Thank you!

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,169050,169050#msg-169050

If perl-scripts without extension the browser tries to download a file,
instead of to execute…

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,169050,169057#msg-169057

Hello!

On Mon, Jan 24, 2011 at 06:41:21AM -0500, daozor wrote:

Hi
Nginx perfectly execute Perl scripts with the extensions *.cgi or *.pl
(www.abc.com/bin/test_perl_script.cgi) via fastcgi.
But I should execute Perl scripts without the extension. For example:
www.abc.com/bin/test_perl_script
How to configure nginx.conf file.

nginx looks on URI to determine how requests should be processed,
and you have to pass appropriate URIs to fastcgi. I.e. to pass
/bin/test_perl_script to fastcgi you should write something like
this in your nginx config:

location = /bin/test_perl_script {
    fastcgi_pass ...
    ...
}

To pass everything under /bin/ write something like this:

location /bin/ {
    fastcgi_pass ...
    ...
}

See here for more details:

http://wiki.nginx.org/HttpCoreModule#location

Maxim D.

In folder /var/www/twiki/bin there are many perl files:
attach
changes
configure
edit
login
logon
logos
manage
oops
preview
rdiff
rdiffauth
register
rename
resetpasswd
rest
save
search
statistics
twiki_cgi
upload
view
viewauth
viewfile

# file configure
configure: perl script text executable

Server/location in nginx.conf:

    server {


        listen                          80;


        server_name                     twiki;





        location                        / {


         root                           /var/www/twiki/;


         index                          index.html;


         }





        location                        /twiki/bin {


         root                           /var/www/twiki/bin/;


         include                        /etc/nginx/fastcgi_params;


         fastcgi_pass                   127.0.0.1:10001;


         fastcgi_param  SCRIPT_FILENAME
/var/www/twiki$fastcgi_script_name;

         }


           }

Go to http://localhost/twiki/bin/configure and browser downloads a file
:frowning:

===
This example is work fine, but here *.cgi …

        location                        ~ .cgi$ {


         root                           /var/www/nagios/cgi-bin/;


         rewrite                        ^/nagios/cgi-bin/(.*)\.cgi
/$1.cgi break;

         include                        /etc/nginx/fastcgi_params;


         fastcgi_pass                   127.0.0.1:10001;


         fastcgi_param  SCRIPT_FILENAME
/var/www/nagios$fastcgi_script_name;

         }

no ideas…

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,169050,169078#msg-169078

On Mon, Jan 24, 2011 at 8:23 PM, daozor [email protected] wrote:

    fastcgi_pass                   127.0.0.1:10001;

check if the fastcgi handler in fastcgi_pass accept non *.cgi / *.pl
files

edogawaconan Wrote:

nginx mailing list
[email protected]
http://nginx.org/mailman/listinfo/nginx

hmmm…
edogawaconan, how i can make it?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,169050,169094#msg-169094

Probably a problem simply in a section location… maybe somehow use
rewrite or another variant…

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,169050,169101#msg-169101

On Mon, Jan 24, 2011 at 9:07 PM, daozor [email protected] wrote:

hmmm…
edogawaconan, how i can make it?

depends on the fastcgi backend itself. Nginx only passes the
parameters to fastcgi backend.

edogawaconan Wrote:

depends on the fastcgi backend itself. Nginx only
passes the
parameters to fastcgi backend.

spawn-fcgi-1.4.18 - spawns fastcgi processes
fcgiwrap version 1.0

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,169050,169113#msg-169113

On Mon, Jan 24, 2011 at 7:25 PM, daozor [email protected] wrote:

If perl-scripts without extension the browser tries to download a file,
instead of to execute…

define in its own location { } block

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs