![画像::[Slicehost] Ubuntuサーバーの高速化2 - Mod_status 画像 - [Slicehost] Ubuntuサーバーの高速化2 - Mod_status](http://de-lab.com/img/smallLogo.jpg)
Apache高速化の続きです。
- PHPの処理速度を簡単に上げることができるモジュールeAcceleratorを導入します。
- ApacheのモジュールMod_statusを使ってApache設定が適正かチェックします。
SourceForge.net: eAcceleratorから最新パッケージのtar.bz2をダウンロードしてvar/wwwにアップ
eacceleratorのインストール
sudo wget http://nchc.dl.sourceforge.net/sourceforge/eaccelerator/eaccelerator-0.9.5.2.tar.bz2 sudo tar jxf eaccelerator-0.9.5.2.tar.bz2 cd eaccelerator-0.9.5.2 su export PHP_PREFIX="/usr/" $PHP_PREFIX/bin/phpize ./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config make make install
キャッシュディレクトリを作る
mkdir /tmp/eaccelerator chmod 777 /tmp/eaccelerator
php.iniの設定
/etc/php5/apache2/php.iniの末尾に追加
[eaccelerator] zend_extension = "/usr/lib/php5/20060613/eaccelerator.so" eaccelerator.shm_size = "32" eaccelerator.cache_dir = "/tmp/eaccelerator" eaccelerator.enable = "1" eaccelerator.optimizer = "1" eaccelerator.check_mtime = "1" eaccelerator.debug = "0" eaccelerator.filter = "" eaccelerator.shm_max = "0" eaccelerator.shm_ttl = "0" eaccelerator.shm_prune_period = "0" eaccelerator.shm_only = "0" eaccelerator.allowed_admin_path = "/var/www/eaccelerator"
リスタート
/etc/init.d/apache2 restart
所々自分の設定に置き換えて下さい。
Mod_status
ここまで出来たら、体感速度で早くなってるのがわかるはずです。
これ以上に無駄がない適正な設定にするために、Apacheの動作状況を監視するモジュールMod_statusを導入します。
apache2.confの設定
sudo vi /etc/apache2/apache2.conf
末尾に追加
# 詳細な情報を表示する ExtendedStatus On # Allow from IPアドレスからのアクセスを許可 <Location /server-status> SetHandler server-status Order Deny,Allow Deny from all Allow from 000.000.000.000 </Location>
リスタート
sudo /etc/init.d/apache2 restart
Mod_statusにアクセス
http://IPアドレス/server-status/
簡単でした。こんな感じの画面が出てきたらおk


