您的位置:首页 > 运维架构 > Nginx

Nginx + Perl FCGI 环境简单设置

2009-04-24 18:47 381 查看

参考文档:

http://technotes.1000lines.net/?p=23

1)

Nginx的安装比较简单这里不说了。不过要支持perl的cgi,需要安装PCRE模块,之后在configure nginx ; make; make install

2)

下载一个事项perl fastcgi的脚本 http://technotes.1000lines.net/fastcgi-wrapper.pl

另外,这个脚本是吧sock文件写到/var/run/nginx/ 目录下的,所以,运行这个脚本的用户要拥有这个目录的写权限。

3)

配置nginx.conf

location ~ ^/cgi-bin/.*/.cgi$ {
gzip off;
fastcgi_pass  unix:/var/run/nginx/perl_cgi-dispatch.sock;
fastcgi_param SCRIPT_FILENAME /www/blah.com$fastcgi_script_name;
include fastcgi_params;
}

这样就完成了Nginx 对 Perl Fastcgi的支持

我让nginx监听的是81端口,因为我的80在给
Apache使用。

访问 http://xx.xx.xx.xx/cgi-bin/a.cgi 之后,就达到目的了。当然a.cig 是一个简单的perl脚本


#!/usr/local/bin/perl

print "Content-type: text/plain; charset=gb2312/n/n";

print "你好,这是cgi程序 /n";
[/code]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: