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

转载于:https://www.cnblogs.com/simplezy/p/6793538.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值