标签:baidu com -o 配置nginx div pass cep 环境 程序
或者去:http://www.pcre.org/
#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; }
TARGET = 1.cgi INSTALL_PATH = . LIBDIRS = -L/usr/local/lib LIBS += -lfcgi CC = gcc CXX = g++ CXXFLAGES += -Wall -O2 LDFLAGS = -Wl,-R /usr/local/lib RM = rm -f CP = cp -f SOURCES += first-cgi.cpp OBJECTS = $(SOURCES:.cpp=.o) .PHONY : all clean all:$(TARGET) $(TARGET):$(OBJECTS) $(CXX) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(LIBDIRS) $(LIBS) $(OBJECTS):%.o:%.cpp $(CXX) -c $(CXXFLAGES) $(INCLUDES) $< -o $@ clean: -$(RM) $(TARGET) $(OBJECTS)
baidu, google了下。发现有一个spawn-fcgi的东西。原本是lighttp 内的fastcgi进程管理器
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/
#!/bin/bash DESTDIR=. HOST=‘127.0.0.1‘ PORT=‘7000‘ PROCESSNAME=‘1.cgi‘ sudo killall -9 $PROCESSNAME echo "=====killed=====" RESTART="sudo /usr/local/nginx/sbin/spawn-fcgi -a $HOST -p $PORT -f $DESTDIR/$PROCESSNAME -F 1" echo $RESTART $RESTART echo "======done======" ps -ef | grep $PROCESSNAME?
server { listen 9990; server_name localhost; #access_log logs/host.access.log main; location / { rewrite ^/(.*)$ localhost; root html; index index.html index.htm; } location ~ (.*) { 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 架构的server环境搭建
标签:baidu com -o 配置nginx div pass cep 环境 程序
原文地址:http://www.cnblogs.com/claireyuancy/p/6849858.html