trzxycx 发表于 2018-11-12 10:48:49

nginx支持perl网页

  nginx支持perl网页:
  注:
  该文档基于Redhat/CentOS系统
  安装nginx略
  先下载fcgi、fcgi-devel、spawn-fcgirpm并进行安装

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 "\n\n";
  print "\n";
  print "CGI Test Page";
  print "\n\n";
  print "\n\n";
  :wq

chmod 705 /usr/share/nginx/html/test.pl
  验证:
  http://ip/test.pl


页: [1]
查看完整版本: nginx支持perl网页