fastcgi(一)
首先安装 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
内容如下:
- #include </usr/local/fastcgi/include/fcgi_stdio.h>
- int main(void){
- while( FCGI_Accept() >= 0){
- printf( "Content-Type: text/html\r\n" );
- printf("\r\n");
- printf( "Hello world in C\n" );
- }
- }
#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的配置要修改
- server {
- listen 80;
- location ~ \.fcgi$ {
- root /srv/www;
- fastcgi_pass 127.0.0.1:9002;
- include fastcgi_params;
- }
- }
重启nginx ,然后用fastcgi 启动程序,同时监听 9002 端口
# /usr/local/fastcgi/bin/cgi-fcgi -start -connect 127.0.0.1:9002 /srv/html/cgi/hello.fcgi
fastcgi(一)的更多相关文章
- CGI与FastCGI nginx+PHP-FPM
本文转载自CGI与FastCGI 1.当我们在谈到cgi的时候,我们在讨论什么 最早的Web服务器简单地响应浏览器发来的HTTP请求,并将存储在服务器上的HTML文件返回给浏览器,也就是静态html. ...
- IIS8 使用FastCGI配置PHP环境支持 过程详解
平时帮朋友们配置过一些PHP环境的服务器,但是一直使用的都是Apache HTTP+PHP,今天呢,我吧IIS+PHP配置方式给大家发一下下~呵呵. 在这里,我使用的是FastCGI模块映射的方式配置 ...
- FastCgi与PHP-fpm之间的关系
web server(比如说nginx)只是内容的分发者.比如,如果请求/index.html,那么web server会去文件系统中找到这个文件,发送给浏览器,这里分发的是静态数据.好了,如果现在请 ...
- CGI与FastCGI
当我们在谈到cgi的时候,我们在讨论什么 最早的Web服务器简单地响应浏览器发来的HTTP请求,并将存储在服务器上的HTML文件返回给浏览器,也就是静态html.事物总是不 断发展,网站也越来越复杂, ...
- 搞不清FastCgi与PHP-fpm之间是个什么样的关系?
问 我在网上查fastcgi与php-fpm的关系,查了快一周了,基本看了个遍,真是众说纷纭,没一个权威性的定义. 网上有的说,fastcgi是一个协议,php-fpm实现了这个协议: 有的说,php ...
- FastCgi与PHP-fpm关系
1 CGI (1)什么是CGI: CGI(Common Gateway Interface)公共网关接口, 是WWW技术中最重要的技术之一,有着不可替代的重要地位, CGI是外部应用程序(CGI程序 ...
- CGI, FastCGI, WSGI, uWSGI, uwsgi简述
CGI 通用网关接口(Common Gateway Interface/CGI)是一种重要的互联网技术,可以让一个客户端,从网页浏览器向执行在网络服务器上的程序请求数据.CGI描述了服务器和请求处理程 ...
- fastcgi与cgi的区别
fastcgi与cgi的区别 先讲下cgi:cgi在2000年或更早的时候用得比较多, 以前web服务器一般只处理静态的请求,如果碰到一个动态请求怎么办呢?web服务器会根据这次请求的内容,然后会fo ...
- nginx+fastcgi+c/cpp
参考:http://github.tiankonguse.com/blog/2015/01/19/cgi-nginx-three/ 跟着做了一遍,然后根据记忆写的,不清楚有没错漏步骤,希望多多评论多多 ...
- 【转】搞清FastCgi与PHP-fpm之间的关系
一.问题:网上有的说,fastcgi是一个协议,php-fpm实现了这个协议: 有的说,php-fpm是fastcgi进程的管理器,用来管理fastcgi进程的: 有的说,php-fpm是php内核的 ...
随机推荐
- 【转】8张图理解Java
一图胜千言,下面图解均来自Program Creek 网站的Java教程,目前它们拥有最多的票选.如果图解没有阐明问题,那么你可以借助它的标题来一窥究竟. 1.字符串不变性 下面这张图展示了这段代码做 ...
- bzoj2044: 三维导弹拦截
Description 一场战争正在A国与B国之间如火如荼的展开. B国凭借其强大的经济实力开发出了无数的远程攻击导弹,B国的领导人希望,通过这些导弹直接毁灭A国的指挥部,从而取得战斗的胜利!当然,A ...
- Django数据库设计中字段为空的方式
今天在做数据库设计的时候,设计了如下User表,其中我把email和phone字段设置为允许为空: class User(models.Model): username = models.CharFi ...
- PL/SQL查询Oracle数据乱码/Oracle客户端乱码解决办法
[如果此方法都试了就是不行,那么就重复尝试,先把环境变量给删了,注册表里的键值也删除了,然后重启,再配置,肯定行!我试过!] 先确定Oracle服务器采用的是何种编码: select userenv( ...
- BIP_开发案例09_结合JavaCP通过BIP API输出报表dataprocess / rtfprocess / foprocess(案例)
20150814 Created By BaoXinjian
- CF534A Exam 构造
An exam for n students will take place in a long and narrow room, so the students will sit in a line ...
- H桥电路
电路特点:有三极管组成4个桥的腿,中间可以使电容或是电机. 应用:直流电机的正反转控制.DC-AC逆变电源(脉冲直流变为周期交流) 关键点:同一个时刻只能对角的一对三极管导通,同侧不能一块导通,共2对 ...
- 深入研究java.lang.ThreadLocal类(转)
引用:http://lavasoft.blog.51cto.com/62575/51926/ 一.概述 ThreadLocal是什么呢?其实ThreadLocal并非是一个线程的本地实现版本,它并 ...
- 在java中使用正则表达式注意的地方
1. 对^与$的理解 通常我们会通过类似Matcher matcher = Pattern.compile(regex).matcher(string);的代码去拿到一个Matcher对象.这种情况下 ...
- 改变select组件的option选中状态的快捷方法
以前我都是在<option>标签处通过判断value是否与其中一个相同然后输出selected="selected"来处理的,今天发现可以直接能过Js改变<sel ...