/ / http_perl_moduleを使用したnginxは、perlスクリプトを実行せず、ダウンロードするだけです-macos、perl、nginx

http_perl_moduleのnginxはperlスクリプトを実行しません - macos、perl、nginx

PerlbrewのPerl-5.16.0を搭載したMacOSX10.7.4ではこれがあります 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;
}
}

この構成でPHPスクリプトを実行するために、コンパイルして実行しました php-fpm、そして今ではPHPを正常に実行します。

Perlスクリプトを実行するために、nginxを次のようにコンパイルしました ./configure --add-module=../ngx-fancyindex --with-http_perl_module そしてnginxはこの構成で正常に動作しますが、 http://localhost:1234/index.pl Perlスクリプトを実行せず、ダウンロードするだけです。

チェックとして、nginxをシャットダウンし、Apacheを起動します。 cgi_module オンにすると、index.plが完全に実行されます。

nginxにPerlスクリプトを実行させるにはどうすればよいですか?ありがとうございました。

回答:

回答№1は1

スクリプトはブラウザに送信されます。これは、リクエストファイルが処理されるデフォルトの方法であり、これを上書きしないためです(たとえば、 fastcgi_pass)。に従ってください 指示.