Apache1.3+FastCGIのインストール(FedoraCore編)

rublogはずっと、Lighttpd + FastCGIで開発してきましたが、自分のホスティング環境であるApache+FastCGIでもでもテストをしておこうと思いFedoraCore5にセットアップしました。その時のメモ。

FedoraCore5にはApache2をインストールしてあったのですが、ホスティング環境がApache1.3.37なのでApache1.3.37を別途セットアップします。また、FastCGImod_fastcgi.2.4.2です。

tar zxvf apache_1.3.37.tar.gz
tar zxvf mod_fastcgi-2.4.2.tar.gz
cd apache_1.3.37/
mv ../mod_fastcgi-2.4.2 ./src/modules/fastcgi
./configure --activate-module=src/modules/fastcgi/libfastcgi.a \
  --enable-module=rewrite
make
make install

最初、mod_fastcgiを単独でmakeしようとして四苦八苦。最初にきちんとドキュメントを読まない悪い癖で、半日近く潰してしまった。組み込みでサードパーティーのモジュールをビルドする場合は、--activate-moduleを使用するとmekeファイルを自動生成して組み込んでくれます。DSOの場合、mod_fastcgiのmakeのため、apache1.3系のapxsが必要になりますので--enable-shared=maxをつけてリビルドします。(今後の利便性を考え最終的にはテストはDSO環境を採用)

tar zxvf apache_1.3.37.tar.gz
cd apache_1.3.37
./configure ./configure --enable-module=rewrite --enable-module=alias \
  --enable-module=access --enable-shared=max
make
make install
tar zxvf mod_fastcgi-2.4.2.tar.gz
cd mod_fastcgi-2.4.2
/usr/local/apache/bin/apxs -o mod_fastcgi.so -c *.c
/usr/local/apache/bin/apxs -i -a -n fastcgi mod_fastcgi.so

http.confにAddModule mod_fastcgi.cとLoadModule fastcgi_module libexec/mod_fastcgi.soが追加されます。後は、アプリケーションの設定をしてとりあえず完了。

<IfModule mod_fastcgi.c>
  FastCgiIpcDir /tmp/fcgi_ipc
  FastCgiServer /path/to/rubricks/public/dispatch.fcgi
</IfModule>
<VirtualHost *:80>
  ServerName rails
  DocumentRoot /path/to/rubricks/public/
  <Directory /path/to/rubricks/public/>
    Options ExecCGI FollowSymLinks
    AddHandler fastcgi-script .fcgi
    AllowOverride all
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

Comments

fc5+apache1.3+fastcgiを上記のインストール手順(activate-module)でやったのですが、こんなエラーがでて、インストールが失敗しましたが。。。

modules/fastcgi/libfastcgi.a(fcgi_util.o): In function `fcgi_util_check_access':/usr/local/src/mod_fastcgi-2.4.2/fcgi_util.c:230: undefined reference to `apr_psprintf'
modules/fastcgi/libfastcgi.a(fcgi_util.o): In function `fcgi_util_fs_is_path_ok':/usr/local/src/mod_fastcgi-2.4.2/fcgi_util.c:384: undefined reference to `apr_psprintf'
:/usr/local/src/mod_fastcgi-2.4.2/fcgi_util.c:381: undefined reference to `apr_psprintf'
:/usr/local/src/mod_fastcgi-2.4.2/fcgi_util.c:378: undefined reference to `apr_psprintf'
:/usr/local/src/mod_fastcgi-2.4.2/fcgi_util.c:370: undefined reference to `apr_palloc'
:/usr/local/src/mod_fastcgi-2.4.2/fcgi_util.c:372: undefined reference to `apr_psprintf'
:/usr/local/src/mod_fastcgi-2.4.2/fcgi_util.c:395: undefined reference to `apr_psprintf'
collect2: ld はステータス 1 で終了しました
make[2]: *** [target_static] エラー 1
make[2]: Leaving directory `/usr/local/src/apache_1.3.37/src'
make[1]: *** [build-std] エラー 2
make[1]: Leaving directory `/usr/local/src/apache_1.3.37'
make: *** [build] エラー 2