之前用过一次Apache,默认支持CGI,只要配置文件配好就好了,但现在环境多用nginx,也比较熟练,查寻了一些资料之后成功执行脚本。
yum install -y gcc gcc-c++ pcre-devel openssl-devel
安装nginx
tar xzvf nginx-1.8.0.tar.gz
cd nginx-1.8.0
./configure --prefix=/web/nginx --with-pcre --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-file-aio --with-ipv6 --with-poll_module --with-select_module --with-rtsig_module
make && make install
配置nginx.conf
location ~ \.(cgi|sh|py) {
gzip off;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.cgi;
include fastcgi.conf;
}
安装spawn-fcgi-1.6.4.tar.gz
tar xzvf ...
./configure
make && make install
安装fcgi-2.4.0.tar.gz
./configure
make && make install
遇到的问题 fcgi-2.4.0/include/fcgio.h 添加#include <stdio.h>
安装fcgiwrap-1.0.2.tar.gz
遇到的问题 yum install -y fcgi-devel autoconf automake
查看README安装
启动
/../bin/spawn-fcgi -a 127.0.0.1 -p 9000 -f /../sbin/fcgiwrap