nginx+fastCGI

首先贴些遇到的问题,之后再整理

1.yum -y install pcre zlib OpenSSL openssl-devel  pcre-devel

2.

nginx: [emerg] "server" directive is not allowed here in /etc/nginx/nginx.conf:134
#答案:是因为我是用错了配置文件                                                                                     

 3.yum whatprovides "*/g++"

  命令解析:该命令为反查命令,此命令的含义是查询g++在哪个安装包里面。
  #gcc-c++
4.yum -y install fcgi fcgi-devel
5.test.c #file
#include "fcgi_stdio.h"
#include <stdlib.h>

int main(void)
{
int count = 0;
while(FCGI_Accept() >= 0)
{
printf("Content-type: text/html\r\n"
"\r\n"
"<title>FastCGI Hello!</title>"
"<h1>FastCGI Hello!</h1>"
"Request number %d running on host <i>%s</i>\n",
++count, getenv("SERVER_NAME"));
}
return 0;
}

 command : spawn-fcgi -a 127.0.0.1 -p 8088 -f cgibin/test2.fcgi 

6.nginx.conf 在server 容器中添加

    location ~ \.fcgi$ {
        fastcgi_pass 127.0.0.1:8088;
        fastcgi_index index.cgi;
        fastcgi_param SCRIPT_FILENAME fcgi$fastcgi_script_name;
        include fastcgi_params;
    }

 

7.重新加载配置文件

kill -HUP `cat logs/nginx.pid`

 

感谢:http://blog.csdn.net/allenlinrui/article/details/19419721

posted @ 2017-05-01 23:04  Zoie  阅读(204)  评论(0编辑  收藏  举报