#include <fcgi_stdio.h> int main( int argc, char *argv[] ) { while( FCGI_Accept() >= 0 ) { FCGI_printf( "Status: 200 OK\r\n" ); FCGI_printf( "Content-Type: text/html\r\n\r\n" ); FCGI_printf( "Hello world in +++++++\n" ); } return 0; }
wget http://www.lighttpd.net/download/lighttpd-1.4.19.tar.gz tar zxvf lighttpd-1.4.19.tar.gz cd lighttpd-1.4.19 ./configure make
cp ./src/spawn-fcgi /usr/local/nginx/sbin/
spawn-fcgi -a 127.0.0.1 -p 7000 -f /home/jiangf/t.cgi
location ~ \.cgi$ { fastcgi_pass 127.0.0.1:7000; fastcgi_index index.cgi; fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; include fastcgi_params; }
Nginx + FastCgi + Spawn-fcgi + C 架构的服务器环境搭建
原文地址:http://blog.csdn.net/nyist327/article/details/40039623