Terry
Terry

Reputation: 1232

nginx with http_perl_module doesn't execute perl scripts just downloads them

On my Mac OSX 10.7.4 with Perlbrew's Perl-5.16.0 I have this nginx.conf:

server {
   listen 1234;
   server_name MyPHPPerlServer;
   root "/Library/WebServer/servdir"; 

location / {
fancyindex on;
}

location ~ \.php$ {
         fastcgi_pass  127.0.0.1:9000;
         fastcgi_index index.php;
         fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
         include fastcgi_params;
         }

location ~ \.pl$ {
         try_files $uri =404;
         gzip off;
     #fastcgi_pass  127.0.0.1:8999;
         fastcgi_index index.pl;
         fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
         include fastcgi_params;
         } 
}

For this configuration to run the PHP scripts, I compiled and ran php-fpm, and it runs PHP fine now.

To run the Perl scripts, I compiled nginx with ./configure --add-module=../ngx-fancyindex --with-http_perl_module and nginx runs fine with this configuration but when I browse to http://localhost:1234/index.pl it doesn't execute the Perl script, it just downloads it.

As a check, I shut down the nginx and start Apache with the cgi_module on and it runs the index.pl perfectly.

What should I do to make nginx run the Perl scripts? Thank you.

Upvotes: 0

Views: 1455

Answers (1)

ikegami
ikegami

Reputation: 386351

The scripts are being sent to the browser because that's the default manner in which request files are handled, and you don't override this (say by using fastcgi_pass). Please follow the instructions.

Upvotes: 1

Related Questions