# Nginx + Perl

**URL:** <https://www.ruby-forum.com/t/nginx-perl/202197>\
**Category:** NGINX\
**Created:** [January 24, 2011, 12:43pm UTC](https://www.ruby-forum.com/t/nginx-perl/202197 "2011-01-24T12:43:01Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [January 24, 2011, 12:43pm UTC](https://www.ruby-forum.com/t/nginx-perl/202197/1 "2011-01-24T12:43:01Z")

</div>

Hi  
Nginx perfectly execute Perl scripts with the extensions \*.cgi or \*.pl  
([www.abc.com/bin/test\_perl\_script.cgi](http://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](http://www.abc.com/bin/test_perl_script)  
How to configure nginx.conf file.

Thank you!

Posted at Nginx Forum:

> **[Nginx + Perl](https://forum.nginx.org/read.php?2,169050,169050#msg-169050)**
>
> 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...

---

<div class="post-metadata">

**Author:** ![daozor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@daozor](https://www.ruby-forum.com/u/daozor)\
**Post date:** [January 24, 2011, 1:26pm UTC](https://www.ruby-forum.com/t/nginx-perl/202197/2 "2011-01-24T13:26:30Z")

</div>

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

Posted at Nginx Forum:

> **[Re: Nginx + Perl](https://forum.nginx.org/read.php?2,169050,169057#msg-169057)**
>
> 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...

---

<div class="post-metadata">

**Author:** ![daozor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@daozor](https://www.ruby-forum.com/u/daozor)\
**Post date:** [January 24, 2011, 1:37pm UTC](https://www.ruby-forum.com/t/nginx-perl/202197/3 "2011-01-24T13:37:12Z")

</div>

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](http://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](http://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:

> **[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki...](https://github.com/nginxinc/nginx-wiki)**
>
> ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com

Maxim D.

---

<div class="post-metadata">

**Author:** ![daozor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@daozor](https://www.ruby-forum.com/u/daozor)\
**Post date:** [January 24, 2011, 2:25pm UTC](https://www.ruby-forum.com/t/nginx-perl/202197/4 "2011-01-24T14:25:01Z")

</div>

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

```auto
# file configure
configure: perl script text executable
```

Server/location in nginx.conf:

```auto
    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](http://localhost/twiki/bin/configure) and browser downloads a file  
☹

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

```auto
        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:

> **[Re: Nginx + Perl](https://forum.nginx.org/read.php?2,169050,169078#msg-169078)**
>
> 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...

---

<div class="post-metadata">

**Author:** ![daozor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@daozor](https://www.ruby-forum.com/u/daozor)\
**Post date:** [January 24, 2011, 2:33pm UTC](https://www.ruby-forum.com/t/nginx-perl/202197/5 "2011-01-24T14:33:49Z")

</div>

On Mon, Jan 24, 2011 at 8:23 PM, daozor [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ```
> fastcgi_pass 127.0.0.1:10001;
> 
> ```

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

---

<div class="post-metadata">

**Author:** ![daozor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@daozor](https://www.ruby-forum.com/u/daozor)\
**Post date:** [January 24, 2011, 3:09pm UTC](https://www.ruby-forum.com/t/nginx-perl/202197/6 "2011-01-24T15:09:00Z")

</div>

## edogawaconan Wrote:

> nginx mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](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](http://forum.nginx.org/read.php?2,169050,169094#msg-169094)

---

<div class="post-metadata">

**Author:** ![daozor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@daozor](https://www.ruby-forum.com/u/daozor)\
**Post date:** [January 24, 2011, 3:12pm UTC](https://www.ruby-forum.com/t/nginx-perl/202197/7 "2011-01-24T15:12:48Z")

</div>

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

Posted at Nginx Forum:

> **[Re: Nginx + Perl](https://forum.nginx.org/read.php?2,169050,169101#msg-169101)**
>
> 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...

---

<div class="post-metadata">

**Author:** ![daozor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@daozor](https://www.ruby-forum.com/u/daozor)\
**Post date:** [January 24, 2011, 3:26pm UTC](https://www.ruby-forum.com/t/nginx-perl/202197/8 "2011-01-24T15:26:39Z")

</div>

On Mon, Jan 24, 2011 at 9:07 PM, daozor [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> hmmm..  
> edogawaconan, how i can make it?

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

---

<div class="post-metadata">

**Author:** ![daozor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@daozor](https://www.ruby-forum.com/u/daozor)\
**Post date:** [January 24, 2011, 3:38pm UTC](https://www.ruby-forum.com/t/nginx-perl/202197/9 "2011-01-24T15:38:00Z")

</div>

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](http://forum.nginx.org/read.php?2,169050,169113#msg-169113)

---

<div class="post-metadata">

**Author:** ![daozor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@daozor](https://www.ruby-forum.com/u/daozor)\
**Post date:** [January 24, 2011, 1:39pm UTC](https://www.ruby-forum.com/t/nginx-perl/202197/10 "2011-01-24T13:39:05Z")

</div>

On Mon, Jan 24, 2011 at 7:25 PM, daozor [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

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

define in its own location { } block
