Nginx Perl FastCGI



apt-get install libfcgi-perl

wget http://www.l-yp.com/usr/uploads/2012/12/979355951.pl -O /usr/bin/fastcgi-wrapper.pl
wget http://www.l-yp.com/usr/uploads/2012/12/3334648281.txt -O /etc/init.d/perl-fcgi
chmod +x /usr/bin/fastcgi-wrapper.pl
chmod +x /etc/init.d/perl-fcgi
update-rc.d perl-fcgi defaults
insserv perl-fcgi

/etc/init.d/perl-fcgi start


NGinx配置

location ~ \.pl|cgi$ {
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;
}

重启Nginx。


方法2

debian/ubuntu 适用 其他系统自己找下有没这个软件包:


apt-get install -y fcgiwrap

编辑/etc/init.d/fcgiwrap

注释掉这行FCGI_SOCKET="/var/run/$NAME.socket"(#FCGI_SOCKET="/var/run/$NAME.socket")

然后再下面添加

FCGI_PORT="8999" (8999为端口,可修改,与nginx配置相同即可)
FCGI_ADDR="127.0.0.1"

同上配置nginx,重启nginx即可。


标签: nginx, perl, FastCGI


添加新评论