1、安装要用到的库
brew install lighttpd
brew install nginx
brew install Spawn-fcgi
//------------------------
2、编写测试代码
test.cpp
#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 C\n" );
  }
  return 0;
}
 
//————————————
编译代码
g++ -o test.cgi test.cpp -L /usr/local/lib/ -lfcgi
 
//------------
启动进程
spawn-fcgi  -a 127.0.0.1 -p 7000 -u www  -f   /data/cgi-bin/test.cgi
 
//修改nginx的nginx.conf(/usr/local/etc/nginx/nginx.conf)
//-------------------------
   location ~ /bin-cgi/\w*?.html$
        {
            fastcgi_pass  127.0.0.1:7000;
            fastcgi_index index.cgi;
            fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
            include fastcgi_params;
        }
 
//—————————————————— 
测试连接

mac Nginx + FastCgi + Spawn-fcgi + c++的更多相关文章

  1. Nginx + FastCGI 程序(C/C++) 搭建高性能web service的Demo及部署发布

       FastCGI编程包括四部分:初始化编码.接收请求循环.响应内容.响应结束循环. FCGX_Request request; FCGX_Init(); ); FCGX_InitRequest(& ...

  2. nginx+fastcgi+c/cpp

    参考:http://github.tiankonguse.com/blog/2015/01/19/cgi-nginx-three/ 跟着做了一遍,然后根据记忆写的,不清楚有没错漏步骤,希望多多评论多多 ...

  3. 【入门篇】Nginx + FastCGI 程序(C/C++) 搭建高性能web service的Demo及部署发布

    http://blog.csdn.net/allenlinrui/article/details/19419721 1.介绍     Nginx - 高性能web server,这个不用多说了,大家都 ...

  4. [转] nginx+FastCGI+c++

    from: http://www.cnblogs.com/xiaouisme/archive/2012/08/01/2618398.html 一 安装 目的:不需支持php等.就html就行了.步骤: ...

  5. nginx fastcgi配置

    1.1 nginx概述nginx简介Nginx是俄罗斯人编写的十分轻量级的HTTP服务器,Nginx,它的发音为“engine X”, 是一个高性能的HTTP和反向代理服务器,同时也是一个IMAP/P ...

  6. Nginx + FastCGI 程序(C/C++)搭建高性能web service的demo

    http://blog.csdn.net/chdhust/article/details/42645313 Nginx + FastCGI 程序(C/C++)搭建高性能web service的Demo ...

  7. Nginx+FastCGI运行原理

    Nginx不支持对外部程序的直接调用或者解析,所有的外部程序(包括PHP)必须通过FastCGI接口来调用.FastCGI接口在Linux下是socket(这个socket可以是文件socket,也可 ...

  8. 记录一次自己对nginx+fastcgi(fpm)+mysql压力测试结果

    nginx + fastcgi(fpm) 压力测试: CentOS release 5.9 16核12G内存 静态页面: 并发1000,压测200秒,测试结果: 系统最大负载5.47 成功响应: 25 ...

  9. nginx fastcgi php-fpm的关系梳理

    CGI(Common Gateway Interface)CGI全称是“公共网关接口”(Common Gateway Interface),HTTP服务器与你的或其它机器上的程序进行“交谈”的一种工具 ...

随机推荐

  1. Kafka自我学习-报错篇

    1. kafka启动出现:Unsupported major.minor version 52.0 错误,  具体的错误输出: Exception in thread "main" ...

  2. ICE学习笔记一----运行官方的java版demo程序

    建议新手和我一样,从官网下载英文文档,开个有道词典,慢慢啃. 官方文档下载: http://download.csdn.net/detail/xiong_mao_1/6300631 程序代码就不说了, ...

  3. nodejs与sqlite

    //打开数据库var db = new sqlite3.Database('xx.db'); // 关闭数据库db.close(); db.run('xx');  // 数据库对象的run函数可以执行 ...

  4. RPC-Thrift(三)

    TProtocol TProtocol定义了消息怎么进行序列化和反序列化的. TProtocol的类结构图如下: TBinaryProtocol:二进制编码格式: TCompactProtocol:高 ...

  5. 解决mysql报错:- Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ'

    mysql执行报错: - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c ...

  6. 培训补坑(day8:树上倍增+树链剖分)

    补坑补坑.. 其实挺不理解孙爷为什么把这两个东西放在一起讲..当时我学这一块数据结构都学了一周左右吧(超虚的) 也许孙爷以为我们是省队集训班... 好吧,虽然如此,我还是会认真写博客(保证初学者不会出 ...

  7. 1、使用Xcode修改iOS项目工程名和路径名

    http://blog.sina.com.cn/s/blog_a42013280101blxo.html 对,好:错,改正. ------ 前言 系统 10.7 狮子 开发平台 xcode 4.5.2 ...

  8. 【bzoj2212&3702】二叉树

    线段树合并入门题. 分别计算左子树的逆序对,右子树的逆序对,合并的时候计算贡献. #include<bits/stdc++.h> #define N 8000005 using names ...

  9. 【POI2017||bzoj4726】Sabota?

    上学期putsnan过了一次,这学期认真写了一遍…… #include<bits/stdc++.h> #define N 500010 using namespace std; ]; ,n ...

  10. Android开发工具--AndroidStudio

    1.Android studio更改快捷键File->setttings  搜索key map就可以更改成自己喜欢的会计键风格了