1,nginx.conf:
http {
......
server {
......
location /fcgi {
fastcgi_pass 127.0.0.1:8181;
include fastcgi_param;
}
......
}
......
}
2,fcgi程序empty.c
#include "fcgi_config.h"
#include <stdlib.h>
#include <unistd.h>
#include "fcgi_stdio.h"
int main ()
{
while (FCGI_Accept() >= 0) {
printf("\r\n"
"\r\n"); //两个空行是必须的,用于分隔http头和体,否则会报50x错误且fast进程退出。
} /* while */
return 0;
}
3,启动fastcgi
spawn-fcgi -a 127.0.0.1 -p 8181 ./empty
4,在firefox中打开
http://localhost/fcgi/