FastCGI with mod_fcgid
mod_fcgidというApacheモジュールがあるので、これでFastCGIを動かせるものかと思ってやってみる。
手順はhttp://www.movabletype.jp/documentation/developer/server/fastcgi.htmlにほぼ沿ってる。
インストール
# 必要なCPANモジュール cpanm FCGI cpanm CGI # ライブラリ インストール sudo su - yum install httpd-devel wget http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz tar zxfv fcgi-2.4.0.tar.gz -C /usr/local/src/ cd /usr/local/src/fcgi-2.4.0 ./configure make make install # mod_fcgid インストール wget http://ftp.riken.jp/net/apache/httpd/mod_fcgid/mod_fcgid-2.3.5.tar.gz tar zxvf mod_fcgid-2.3.5.tar.gz -C /usr/local/src/ cd /usr/local/src/mod_fcgid-2.3.5/ ./configure.apxs make make install
httpd.conf
- /etc/httpd/conf.d/fcgid.conf
ScriptAlias /fcgi/ /home/kotaro/fcgi/ <IfModule mod_fcgid.c> AddHandler fcgid-script .fcgi SocketPath /tmp/fcgid_sock/ IPCConnectTimeout 20 MaxProcessCount 8 DefaultMaxClassProcessCount 2 TerminationScore 10 SpawnScore 80 IdleTimeout 300 </IfModule>
fcgi script
mkdir /home/kotaro/fcgi vi fcgi/hello.fcgi
http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.htmlから拝借したスクリプトを置く
#!/usr/bin/perl use lib '/home/kotaro/perl5/lib'; use lib '/home/kotaro/perl5/lib/perl5/i386-linux-thread-multi'; use CGI::Fast; while (my $q = CGI::Fast->new) { print("Content-Type: text/plain\n\n"); foreach $var (sort(keys(%ENV))) { $val = $ENV{$var}; $val =~ s|\n|\\n|g; $val =~ s|"|\\"|g; print "${var}=\"${val}\"\n"; }
あとはpermissionを設定し、http://localhost/fcgi/hello.fcgiすれば動く!
が、ここまで来て、
http://www.mail-archive.com/mod-fcgid-users@lists.sourceforge.net/msg00222.html
> Is "FastCgiExternalServer" supported by mod_fcgid?
mod_fastcgi and mod_fcgid are totally different modules and don't even
share a common codebase. They have only the FastCGI protocol in common.
Thus, Apache Directives are totally different. Besides, mod_fcgid has an
adaptive-spawning design and does not support "Static" servers or
External servers.I guess the short answer is : no, and not planned.
という文章を見つけて凹む。。。