nginx支持perl网页

nginx支持perl网页:

注:
该文档基于Redhat/CentOS系统

安装nginx略

先下载fcgi、fcgi-devel、spawn-fcgi rpm并进行安装

wget http://github.com/gnosek/fcgiwrap/tarball/master -O fcgiwrap.tar.gz

tar zxfv fcgiwrap.tar.gz

cd gnosek-fcgiwrap-99c942c

autoreconf -i

./configure

make && make install

vi /etc/sysconfig/spawn-fcgi

OPTIONS="-u nginx -g nginx -a 127.0.0.1 -p 8999 -P /var/run/spawn-fcgi.pid -- /usr/local/sbin/fcgiwrap"
:wq

/etc/init.d/spawn-fcgi start

chkconfig --level 35 spawn-fcgi on

vi /etc/nginx/conf.d/default.conf

location ~ \.pl$
  {
     include fastcgi_params;
    fastcgi_pass 127.0.0.1:8999;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
     fastcgi_index index.pl;
   }

:wq

service nginx restart

测试页面:

vi /usr/share/nginx/html/test.pl

#!/usr/bin/perl

print "Content-type:text/html\n\n";
print "<html>\n<body>\n";
print "<dir style=\"width: 100%; font-size: 40px; font-weight: bold; text-align: center;\">\n";
print "CGI Test Page";
print "\n</div>\n";
print "</body>\n</html>\n";

:wq

chmod 705 /usr/share/nginx/html/test.pl

验证:

http://ip/test.pl

相关文章
相关标签/搜索