Install Apache+fastcgi+php on FreeBSD

環境:

這篇的使用環境是 FreeBSD 7-Release @ 2008/04/12, 使用 ports 安裝

安裝:

安裝 apache2.2 並使用 worker mpm

# cd /usr/ports/www/apache22; make WITH_MPM=worker all install

安裝以後使用 pkg_info 查看會顯示

apache-worker-2.2.8 Version 2.2 of Apache web server with worker MPM.

如果是預設的 prefork 則是顯示
apache-2.2.8        Version 2.2 of Apache web server with prefork MPM.

安裝 mod_fcgid

# cd /usr/ports/www/mod_fcgid; make all install

mod_fcgid 和 mod_fastcgi 的差別( from www/mod_fcgid/pkg-descr )

mod_fcgid — an alternative FastCGI module for Apache2

mod_fcgid has a new process management strategy, which concentrates on
reducing the number of fastcgi server, and kick out the corrupt
fastcgi server as soon as possible.

mod_fcgid is binary-compatible with mod_fastcgi so your existing fastcgi
programs do not need to be recompiled. mod_fcgid supports suEXEC.

安裝 php5

# cd /usr/ports/lang/php5; make all instal

設定:

在 httpd.conf (/usr/local/etc/apache22/httpd.conf) 裡增加

LoadModule fcgid_module libexec/apache22/mod_fcgid.so

設定 FCGI php warpper,讓 .fcgi 和 .php 的檔案由 fcgid-script 來處理,並指定透過 php-cgi 來執行 .php

<IfModule mod_fcgid.c>
AddHandler fcgid-script .fcgi .php
FCGIWrapper /usr/local/bin/php-cgi .php
</IfModule>

重新啟動 apache2

參考資料:

  1. FastCGI介紹
  2. FreeBSD Configure Apache 2.2 PHP with FastCGI mod_fcgi Module
  3. The C10K problem1
  4. Apache setup with PHP-FastCGI
  1. 指單一機器處理1萬個連線 []

One Response to “Install Apache+fastcgi+php on FreeBSD”

  1. Recent Faves Tagged With "c10k" : MyNetFaves Says:

    [...] public links >> c10k Install Apache+fastcgi+php on FreeBSD First saved by butterflychick | 1 days ago Long live Apache; Why NginX is the next king of [...]

Leave a Reply