Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have NGINX working happily with PHP FPM all tickety-boo.

I am trying to add some Perl pages. I have this in my default site config;

    location ~ \.pl$ {
            gzip off;
            include fastcgi_params;
            fastcgi_pass  127.0.0.1:9000;
            fastcgi_index index.pl;
            fastcgi_param SCRIPT_FILENAME /usr/share/nginx/www/$fastcgi_script_name;
    }

Browsing to perl pages (example below) in my browser just displays the source code. It's like either the code isn't being passed to the FPM or its not executing it and just passing it back.

I don't know what to do here; I'm not sure how to troubleshoot this. Nothing in NGINX error.log or php5-fpm.log.

test.pl;

#!/usr/bin/perl

print "Content-type:text/html\n\n";
print <<EndOfHTML;
<html><head><title>Perl Environment Variables</title></head>
<body>
<h1>Perl Environment Variables</h1>
EndOfHTML

foreach $key (sort(keys %ENV)) {
    print "$key = $ENV{$key}<br>\n";
}

print "</body></html>";
share|improve this question

1 Answer 1

up vote 0 down vote accepted

Why would this work? PHP-FPM can only process PHP, duh!

However I was hoping that I would pass Perl scripts to the FPM and it would pass them over to perl. I found this page (link below) which answered my question and clears things up nicely.

Why pass a Perl script onto FPM, to then pass it onto Perl, when you can pass it straight to Perl your self with a wrapper! :D

http://wiki.nginx.org/SimpleCGI

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.