fastcgi(一)
来源:互联网 发布:eufi ubuntu 32位 编辑:程序博客网 时间:2024/05/16 02:42
首先安装 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(一)
- FastCGI模块(FastCGI)
- FastCGI模块(FastCGI)
- 移植 Nginx+PHP(FastCGI) 到 ARM Linux (一)
- CGI/FastCGI学习-篇一
- nginx FastCGI模块(FastCGI)配置
- 杂谈(fastcgi)
- FastCGI
- FastCGI
- fastcgi
- fastcgi
- fastcgi
- fastcgi
- fastcgi
- FastCGI
- FastCGI
- FastCGI
- FastCGI
- Struts2整合SiteMesh
- LoadRunner 11 安装及破解
- (6)QlikView中的Above函数
- vmware界面太小问题的解决
- ubuntu 12.04安装PIL tesseract进行验证码识别
- fastcgi(一)
- 链式二叉树的后序创建、递归后序遍历、非递归堆栈后序遍历、后序销毁
- 如何设置多个用户RDP连接到win2008 server
- EPP3安装SVN
- UCenter跨域、单点登陆机制分析
- javaEE post方式重定向
- 漫画《我》(一个程序员亲手画的)
- 编辑文章 - 博客频道 - CSDN.NET
- 求子数组之和最大值