在我的Mac OSX 10.7.4上使用Perlbrew的Perl-5.16.0我有 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并启动了 cgi_module 的Apache,它完全运行了index.pl。
如何让nginx运行Perl脚本?谢谢。