首先安装 fastcgi 开发包 ...

#wget http://www.fastcgi.com/dist/fcgi-current.tar.gz

#tar -zxvf fcgi-current.tar.gz

#cd fcgi-2.4.0

#./configure --prefix=/usr/local/fastcgi/

#make && make install

写一个简单的fcgi 程序

#vim hello.c

内容如下:

  1. #include </usr/local/fastcgi/include/fcgi_stdio.h>
  2. int main(void){
  3. while( FCGI_Accept() >= 0){
  4. printf( "Content-Type: text/html\r\n" );
  5. printf("\r\n");
  6. printf( "Hello world in C\n" );
  7. }
  8. }

#gcc -o hello.fcgi hello.c -L /usr/local/fastcgi/lib/ -lfcgi

[root@lxp2 Downloads]# tar -xf nginx-1.0.10.tar.gz 

[root@lxp2 Downloads]# cd nginx-1.0.10

[root@lxp2 nginx-1.0.10]# ./configure

checking for PCRE library ... not found

checking for PCRE library in /usr/local/ ... not found

checking for PCRE library in /usr/include/pcre/ ... not found

checking for PCRE library in /usr/pkg/ ... not found

checking for PCRE library in /opt/local/ ... not found





./configure: error: the HTTP rewrite module requires the PCRE library.

You can either disable the module by using --without-http_rewrite_module

option, or install the PCRE library into the system, or build the PCRE library

statically from the source with nginx by using --with-pcre=<path> option.

这说明系统中缺少PCRE库。该库是实现正则表达式的基础,如果缺少此库,nginx无法支持HTTP中的URL重写功能。如果你不需要此功能,可以在执行编译配置脚本时加入“--without-http_rewrite_module”。但是,这里我们需要这项功能。于是下载PCRE库。

2.下载安装PCRE库:

PCRE库是实现Perl式正则表达式的基础。如果系统中缺少此库需要编译安装。可以从著名的开源软件网站sourceforge上下载:http://sourceforge.net/projects/pcre/files/pcre/。目前最新版本是8.20。

仍然是下载后解压、配置、编译和安装:

nginx path prefix: "/usr/local/nginx"

  nginx binary file: "/usr/local/nginx/sbin/nginx"

  nginx configuration prefix: "/usr/local/nginx/conf"

  nginx configuration file: "/usr/local/nginx/conf/nginx.conf"

  nginx pid file: "/usr/local/nginx/logs/nginx.pid"

  nginx error log file: "/usr/local/nginx/logs/error.log"

  nginx http access log file: "/usr/local/nginx/logs/access.log"

  nginx http client request body temporary files: "client_body_temp"

  nginx http proxy temporary files: "proxy_temp"

  nginx http fastcgi temporary files: "fastcgi_temp"

  nginx http uwsgi temporary files: "uwsgi_temp"

  nginx http scgi temporary files: "scgi_temp"

[root@lxp2 nginx-1.0.10]# make

[root@lxp2 nginx-1.0.10]# sudo make install

nginx.conf的配置要修改

  1. server {
  2. listen 80;
  3. location ~ \.fcgi$ {
  4. root           /srv/www;
  5. fastcgi_pass   127.0.0.1:9002;
  6. include        fastcgi_params;
  7. }
  8. }

重启nginx ,然后用fastcgi 启动程序,同时监听 9002 端口

# /usr/local/fastcgi/bin/cgi-fcgi -start -connect 127.0.0.1:9002 /srv/html/cgi/hello.fcgi

fastcgi(一)的更多相关文章

  1. CGI与FastCGI nginx+PHP-FPM

    本文转载自CGI与FastCGI 1.当我们在谈到cgi的时候,我们在讨论什么 最早的Web服务器简单地响应浏览器发来的HTTP请求,并将存储在服务器上的HTML文件返回给浏览器,也就是静态html. ...

  2. IIS8 使用FastCGI配置PHP环境支持 过程详解

    平时帮朋友们配置过一些PHP环境的服务器,但是一直使用的都是Apache HTTP+PHP,今天呢,我吧IIS+PHP配置方式给大家发一下下~呵呵. 在这里,我使用的是FastCGI模块映射的方式配置 ...

  3. FastCgi与PHP-fpm之间的关系

    web server(比如说nginx)只是内容的分发者.比如,如果请求/index.html,那么web server会去文件系统中找到这个文件,发送给浏览器,这里分发的是静态数据.好了,如果现在请 ...

  4. CGI与FastCGI

    当我们在谈到cgi的时候,我们在讨论什么 最早的Web服务器简单地响应浏览器发来的HTTP请求,并将存储在服务器上的HTML文件返回给浏览器,也就是静态html.事物总是不 断发展,网站也越来越复杂, ...

  5. 搞不清FastCgi与PHP-fpm之间是个什么样的关系?

    问 我在网上查fastcgi与php-fpm的关系,查了快一周了,基本看了个遍,真是众说纷纭,没一个权威性的定义. 网上有的说,fastcgi是一个协议,php-fpm实现了这个协议: 有的说,php ...

  6. FastCgi与PHP-fpm关系

    1 CGI  (1)什么是CGI: CGI(Common Gateway Interface)公共网关接口, 是WWW技术中最重要的技术之一,有着不可替代的重要地位, CGI是外部应用程序(CGI程序 ...

  7. CGI, FastCGI, WSGI, uWSGI, uwsgi简述

    CGI 通用网关接口(Common Gateway Interface/CGI)是一种重要的互联网技术,可以让一个客户端,从网页浏览器向执行在网络服务器上的程序请求数据.CGI描述了服务器和请求处理程 ...

  8. fastcgi与cgi的区别

    fastcgi与cgi的区别 先讲下cgi:cgi在2000年或更早的时候用得比较多, 以前web服务器一般只处理静态的请求,如果碰到一个动态请求怎么办呢?web服务器会根据这次请求的内容,然后会fo ...

  9. nginx+fastcgi+c/cpp

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

  10. 【转】搞清FastCgi与PHP-fpm之间的关系

    一.问题:网上有的说,fastcgi是一个协议,php-fpm实现了这个协议: 有的说,php-fpm是fastcgi进程的管理器,用来管理fastcgi进程的: 有的说,php-fpm是php内核的 ...

随机推荐

  1. quotas and disk replace on netapp

    ==================================================================================================== ...

  2. erlang的escript脚本

    参考霸爷的博客 测试例子 #!/usr/bin/env escript %%! -smp enable -sname mmcshadow -mnesia debug verbose[/color] m ...

  3. 修改mongodb oplog size

    转载地址:http://blog.csdn.net/huwei2003/article/details/43307647 修改mongodb oplog size oplog简介: oplog:ope ...

  4. hadoop作业调优参数整理及原理(转)

    1 Map side tuning参数 1.1 MapTask运行内部原理 当map task开始运算,并产生中间数据时,其产生的中间结果并非直接就简单的写入磁盘.这中间的过程比较复杂,并且利用到了内 ...

  5. iphone dev 入门实例7:How to Add Splash Screen in Your iOS App

    http://www.appcoda.com/how-to-add-splash-screen-in-your-ios-app/ What’s Splash Screen? For those who ...

  6. DBA_基本Bash语法汇总(汇总)

     2014-06-26 Created By BaoXinjian

  7. HDU 2188 悼念512汶川大地震遇难同胞――选拔志愿者(巴什博奕)

    选拔志愿者 题意: 对于四川同胞遭受的灾难,全国人民纷纷伸出援助之手,几乎每个省市都派出了大量的救援人员,这其中包括抢险救灾的武警部队,治疗和防疫的医护人员,以及进行心理疏导的心理学专家.根据要求,我 ...

  8. jsonp跨域请求的问题

    今天发现json取数据的时候有时会报如下的错误: No 'Access-Control-Allow-Origin' header is present on the requested resourc ...

  9. EL表达式介绍

    EL 全名为Expression Language EL 语法很简单,它最大的特点就是使用上很方便.接下来介绍EL主要的语法结构: ${sessionScope.user.sex} 所有EL都是以${ ...

  10. jQuery formValidator表单验证插件常见问题

    1.    如何实现一个控件,根据不同的情况,实现不同的控制? 2.    一个页面上我有几个tab页,如何实现每个Tab页上的控件单独校验? 3.    我采用的页面上文字问题的方式,点提交的时候, ...