FreeBSD/Apache2.2
Apache2.2/PHP 5.2.1にバージョンアップ †
環境 †
- FreeBSD 6.1-RELEASE
- PHP 5.2.1
- Apache/2.2.4
インストール/アップグレード †
- /usr/local/etc/pkgtools.confのMAKE_ARGSに以下を追加
'www/apache*' =>[ 'WITH_PROXY_MODULES=no', 'WITH_SUEXEC=yes', 'SUEXEC_DOCROOT=/home', 'SUEXEC_LOGFILE=/var/log/apache/suexec.log', ],
※SuEXECの動作にはsuidperlが必要です。
- アップグレードの場合
# portupgrade -o www/apache22 apache
- インストールの場合
# portupgrade apache
起動するとエラーが出てる †
- Apache2.2を起動するとこんなエラーが出てる。
[warn] (2)No such file or directory: Failed to enable the 'httpready' Accept Filter
- accf_http という FreeBSD のカーネルモジュールが無いということらしい
- このようにモジュールを読み込んでやると警告エラーは出なくなる。
# kldload accf_http.ko
- loader.confに追加しておく
# vi /boot/loader.conf accf_http_load="YES"
- /etc/rc.confに下記のように書き込んでおくと、起動時に/usr/local/etc/rc.d/apache22.shでaccf_httpを読み込んでくれる。
# vi /etc/rc.conf apache22_enable="YES" apache22_http_accept_enable="YES"
- 下記のようなエラーが出る場合
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for. ServerName
- httpd.confにServerName 127.0.0.1を追加するとエラーが出なくなります。
PHP5.2.1にバージョンアップ †
# tar zxvf php-5.2.1.tar.gz # cd php-5.2.1 # ./configure --with-apxs2=/usr/local/apache2/bin/apxs \ --with-mysql=/usr/local \ --with-pgsql=/usr/local/pgsql \ --enable-cgi --disable-cli \ --disable-pear \ --with-tsrm-pth \ --with-gd --with-zlib \ --with-freetype-dir=/usr/local \ --with-jpeg-dir=/usr/local \ --with-png-dir=/usr/local \ --enable-force-cgi-redirect \ --enable-mbstring \ --enable-mbstr-enc-trans \ --enable-trans-sid \ --enable-versioning \ --enable-gd-native-ttf \ --enable-gd-jis-conv #make ;make install
- コンフィグでエラーがlibxml2をインストールするようにいっているらしい
configure: error: xml2-config not found. Please check your libxml2 installation.
- /usr/ports/textproc/libxml2
# cd /usr/ports/textproc/libxml2 # make install
- phpをバージョンアップするとeacceleratorも再インストールする必要がある。 eAcceleratorインストール
自己認証 †
「/usr/local/etc/apache22/ssl」ディレクトリに作成とする。
- ディレクトリ移動
# cd /usr/local/etc/apache22/ssl
- 秘密鍵の作成
# openssl genrsa -out server.key 1024
- 秘密鍵からサーバのx509証明書発行要求(CSR)を作成
# openssl req -new -key server.key -out /root/server.csr
- 自己署名で証明書を作成
# openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 365 Signature ok subject=/C=JP/ST=Kanagawa/L=Yokohama-Si/O=unpush network./CN=www.unpush.net/emailAddress=admin@unpush.net Getting Private key