让apache支持fastcgi(原创)
apache是装好的,今天,想添加fastcgi第三方模块.
测试脚本(test.fcgi):
#!/usr/bin/perl
use FCGI;
my $count = 0;
my $request = FCGI::Request();
while($request->Accept() >= 0) {
print("Content-type: text/html\r\n\r\n", ++$count);
}
需要先安装FCGI.pm模块
下载:http://www.cpan.org/modules/by-module/FCGI/
安装流程
解压tar zxvf FCGI-0.67.tar.gz
编译perl Makefile.PL
make
make install
完成!
下载(fastcgi)mod_fastcgi-2.4.6
http://www.fastcgi.com/dist/
tar zxvf mod_fastcgi-2.4.6.tar.gz
安装方法(共计两种):
第一种:
(步骤)more INSTALL.AP2(因为apache是2.x版本)
*NIX
====
$ cd <mod_fastcgi_dir>
$ cp Makefile.AP2 Makefile
$ make
$ make install
修改httpd.conf 添加
LoadModule fastcgi_module modules/mod_fastcgi.so
在虚拟主机上(virturalhost)添加
Alias /fcgi/ /web/upload001/fcgi/
<Directory /web/upload001/fcgi/>
AllowOverride None
Options +ExecCGI -Includes
AddHandler fastcgi-script .fcg .fcgi
Order allow,deny
Allow from all
</Directory>
第二种:
(步骤)手动dso安装,顺利
# tar zxf mod_fastcgi-2.4.6.tar.gz
# cd od_fastcgi-2.4.6
# apxs -o mod_fastcgi.so -c *.c
# apxs -i -a -n fastcgi .libs/mod_fastcgi.so
在虚拟主机上(virturalhost)添加
Alias /fcgi/ /web/upload001/fcgi/
<Directory /web/upload001/fcgi/>
AllowOverride None
Options +ExecCGI -Includes
AddHandler fastcgi-script .fcg .fcgi
Order allow,deny
Allow from all
</Directory>
再用http://IP/fcgi/test.fcgi能看到数字,刷新后,增加就表示成功了.....