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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章