NGINX + Perl

2078 단어 nginx서버perl
nginx 결합 perl
 
Configure Nginx to execute Perl script.
This example shows to use fcgiwrap + spawn-fcgi.  
보조 소프트웨어 패 키 지 를 설치 하 세 요!
# yum �Cenablerepo=epel -y install spawn-fcgi fcgi-devel 
# yum -y groupinstall "Development Tools" 
 
fcgiwrap 설치 
# wget  http://github.com/gnosek/fcgiwrap/tarball/master -O fcgiwrap.tar.gz 
# tar zxvf fcgiwrap.tar.gz 
# cd gnosek-fcgiwrap-* 
gnosek-fcgiwrap-4b2151e]# 
autoreconf -i 
gnosek-fcgiwrap-4b2151e]# 
./configure 
gnosek-fcgiwrap-4b2151e]# 
make 
gnosek-fcgiwrap-4b2151e]# 
make install 
install -d -m 755 /usr/local/sbin
install -m 755 fcgiwrap /usr/local/sbin
install -d -m 755 /usr/local/man/man8
install -m 644 fcgiwrap.8 /usr/local/man/man8
 
설정 nginx
# vim  /etc/sysconfig/spawn-fcgi 
\ # 마지막 에 추가
OPTIONS="-u nginx -g nginx -a 127.0.0.1 -p 9001 -P /var/run/spawn-fcgi.pid ― /usr/local/sbin/fcgiwrap" 
# vim /etc/nginx/conf.d/default.conf 
\ # server 부분 에 추가
  location ~ \.pl|cgi$ {          fastcgi_pass   127.0.0.1:9001;          fastcgi_index  index.cgi;          fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;          include        /etc/nginx/fastcgi_params;      }            php     ??

# /etc/rc.d/init.d/nginx restart
Stopping nginx: [ OK ] Starting nginx: [ OK ]
# /etc/rc.d/init.d/spawn-fcgi start
Starting spawn-fcgi: [ OK ]
# chkconfig spawn-fcgi on 
cgi 스 크 립 트 만 들 기
# vim /usr/share/nginx/html/index.cgi 
#!/usr/bin/perl    print "Content-type: text/html

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

"; print "";
# chmo
d 705 /usr/share/nginx/html/index.cgi 、
테스트 접근 경로:http://www.iopenstack.com/index.cgi

좋은 웹페이지 즐겨찾기