资源简介
http://blog.csdn.net/wangkangluo1/archive/2011/05/11/6411641.aspx
[原创] Redhat 上 FastCGI 安装与配置
软件包
相关软件包:
httpd
httpd-devel
fcgi-2.4.0.tar.gz
mod_fastcgi-2.4.6.tar.gz 请仔细阅读其中的README
配置httpd.conf:
LoadModule fastcgi_module modules/mod_fastcgi.so
AddHandler fastcgi-script .fcgi # you can put whatever extension you want
FastCgiIpcDir /tmp
FastCgiServer /home/m/Dev/cvs/ImRoBot5/shdaily/cgi/shdaily.fcgi -processes 1 -idle-timeout 1000
代码片段和文件信息
/*
* cgifcgi.c --
*
* CGI to FastCGI bridge
*
*
* Copyright (c) 1996 Open Market Inc.
*
* See the file “LICENSE.TERMS“ for information on usage and redistribution
* of this file and for a DISCLAIMER OF ALL WARRANTIES.
*
*/
#ifndef lint
static const char rcsid[] = “$Id: cgi-fcgi.cv 1.15 2001/09/01 01:14:28 robs Exp $“;
#endif /* not lint */
#include
#include
#include
#include
#include
#include
#include
#include “fcgi_config.h“
#ifdef HAVE_NETDB_H
#include
#endif
#ifdef _WIN32
#include
#include
#else
extern char **environ;
#endif
#ifdef HAVE_SYS_PARAM_H
#include
#endif
#ifdef HAVE_SYS_TIME_H
#include
#endif
#ifdef HAVE_UNISTD_H
#include
#endif
#include “fcgimisc.h“
#include “fcgiapp.h“
#include “fastcgi.h“
#include “fcgios.h“
static int wsReadPending = 0;
static int fcgiReadPending = 0;
static int fcgiWritePending = 0;
static void ScheduleIo(void);
/*
* Simple buffer (not ring buffer) type used by all event handlers.
*/
#define BUFFLEN 8192
typedef struct {
char *next;
char *stop;
char buff[BUFFLEN];
} Buffer;
/*
*----------------------------------------------------------------------
*
* GetPtr --
*
* Returns a count of the number of characters available
* in the buffer (at most n) and advances past these
* characters. Stores a pointer to the first of these
* characters in *ptr.
*
*----------------------------------------------------------------------
*/
static int GetPtr(char **ptr int n Buffer *pBuf)
{
int result;
*ptr = pBuf->next;
result = min(n pBuf->stop - pBuf->next);
pBuf->next += result;
return result;
}
/*
*----------------------------------------------------------------------
*
* MakeHeader --
*
* Constructs an FCGI_Header struct.
*
*----------------------------------------------------------------------
*/
static FCGI_Header MakeHeader(
int type
int requestId
int contentLength
int paddingLength)
{
FCGI_Header header;
ASSERT(contentLength >= 0 && contentLength <= FCGI_MAX_LENGTH);
ASSERT(paddingLength >= 0 && paddingLength <= 0xff);
header.version = FCGI_VERSION_1;
header.type = (unsigned char) type;
header.requestIdB1 = (unsigned char) ((requestId >> 8) & 0xff);
header.requestIdB0 = (unsigned char) ((requestId ) & 0xff);
header.contentLengthB1 = (unsigned char) ((contentLength >> 8) & 0xff);
header.contentLengthB0 = (unsigned char) ((contentLength ) & 0xff);
header.paddingLength = (unsigned char) paddingLength;
header.reserved = 0;
return header;
}
/*
*----------------------------------------------------------------------
*
* MakeBeginRequestBody --
*
* Constructs an FCGI_BeginRequestBody record.
*
*-------------------------------------------
- 上一篇:asp考试系统源码
- 下一篇:mod_fastcgi-2.4.6.tar.gz
评论
共有 条评论