首先安装 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. 查看CentOS版本方法

    查看内核版本 这个命令适用于所有的linux,包括Redhat.SuSE.Debian.Centos等发行版. root@MyMail ~ # uname Linux root@MyMail ~ # ...

  2. android学习笔记41——图形图像处理1

    图像图像处理 ImageView:用于显示普通静态图片: AnimationDrawable:用于开发逐帧动画: Animation:用于对普通图片使用补间动画: Bitmap.BitmapFacto ...

  3. "unresolved external symbol __imp__WSACleanup@0"

    编译时出现这种问题怎么解决:"unresolved external symbol __imp__WSACleanup@0"出现此类问题一般是ws2_32.lib这个lib没有li ...

  4. 黄聪:wordpress更新失败‘C:\Windows\TEMP/wordpress.tmp’,更换临时保存路径的解决办法

    1.如果可劲进入远程桌面,则给C:\WINDOWS\TEMP目录设置IIS访问权限. 2.虚拟机的方法:首先用FTP软件在网页空间wp-content目录中新建一个[tmp]目录,然后在wp-conf ...

  5. C# Base64字符串转换成图片及图片转换为Base64

    最近有朋友经常会问我一些问题,例如,如何把一个字符串转换成base64字符串,如何把一个二进制文件转换成Base64文件,以及如何转换回原有的文件,在此我把方法写一下   字符串与Base64相互转换 ...

  6. 用CRT connect MongoDB 使用Backspace无效

    这是个很蛋疼的小问题... 使用./mongo 10.1.235.62:27017 连接上后 打错了无法删除!? 这是在逗我,那就修改CRT个设置,点击选项,会话选项,仿真,把终端改成Linux就行了 ...

  7. Shell 重定向 &>file,2>&1,1>&2 的区别

    Shell上:0表示标准输入1表示标准输出2表示标准错误输出> 默认为标准输出重定向,与1>相同2>&1 意思是 把标准错误输出重定向到标准输出1>&2 意思是 ...

  8. android之location 根据接口获取经纬度信息

    http://maps.googleapis.com/maps/api/geocode/json?address=%E7%A6%8F%E5%BB%BA&sensor=falsehttp://m ...

  9. ruby 字符串学习笔记3

    ascii转字符或者字符串转ascii "a".ord # => 97 "!".ord # => 33 "\n".ord # = ...

  10. 出现java.lang.NoClassDefFoundError: com/google/common/base/Charsets异常错误

    使用selenium,出现java.lang.NoClassDefFoundError: com/google/common/base/Charsets异常错误 原因:selenium-server- ...