さんきゅう堂的_バックアップ
MovableType4.01をFastCGIで高速化?
- Prev Page: MovableType3.34から3.35にバージョンアップ
環境
openSUSE10.3(10.2からのバージョンアップ)
apache2.2.4
apache2-mod_fcgid2.1-19
perl5.8.8
参考先
Ogawa::Memoranda
De Rerum Natura
まずはMT-Dispatch(プラグイン)をDL Download version 1.4.
/mt/plugins/にアップ
Perlモジュールの追加
FCGI
FCGI::ProcManager
Sub::OverrideFile
File::Slurp
# perl -MCPAN -e shell/mt/以下のファイル拡張子をcgiからfcgiに変更
cpan shell -- CPAN exploration and modules installation (v1.7602)
ReadLine support enabled
cpan> install FCGI
省略
/usr/bin/make install UNINST=1 -- OK
cpan> install FCGI::ProcManager
省略
/usr/bin/make install UNINST=1 -- OK
cpan> install Sub::OverrideFile
省略
/usr/bin/make install UNINST=1 -- OK
cpan> install File::Slurp
省略
/usr/bin/make install UNINST=1 -- OK
cpan> quit
mt.fcgi
mt-comments.fcgi
mt-tb.fcgi
mt-search.fcgi (エラーが出るようなら#コメントアウト)
mt-view.fcgi
/mt/mt-config.cgiに以下を追記(CGIPathの下に挿入)
AdminScript mt.fcgi
CommentScript mt-comments.fcgi
TrackbackScript mt-tb.fcgi
SearchScript mt-search.fcgi (エラーが出るようなら#コメントアウト)
ViewScript mt-view.fcgi
LaunchBackgroundTasks 1
/etc/apache2/conf.d/mod-fcgid.conf
##
## Sample config for apache2_mod-fcgid
##
## All lines, that are commented out, reflect the default values.
##
<IfModule fcgid_module>
##
## An idle fastcgi application will be terminated after IdleTimeout seconds.
##
IdleTimeout 300
##
## The scan interval for idle fastcgi applications in seconds.
##
IdleScanInterval 120
##
## a fastcgi application will be terminated if handing a single request longer
## than busy timeout. Value in seconds.
##
BusyTimeout 300
##
## The scan interval for busy timeout fastcgi applications. Value in seconds.
##
BusyScanInterval 120
##
## The scan interval for exit pending fastcgi applications. fastcgi applications
## will be terminated within this scanning. Value in seconds.
##
ErrorScanInterval 3
##
## The scan interval for zombie process. Value in seconds.
##
ZombieScanInterval 3
##
##
## A fastcgi application will be terminated if lifetime expired, even no error
## is detected. Value in seconds.
##
ProcessLifeTime 3600
##
## The directory to put the UNIX domain socket. (UNIX only)
##
SocketPath /var/lib/apache2/fcgid/
##
## The spawn-speed control score up water limit. Score increases while a process
## is spawned or terminated, and decreases as time progresses; while the score is
## higher than SpawnScoreUpLimit, the spawning will be held for a while. The
## higher this number is, the higher speed of the spawning can be.
##
#SpawnScoreUpLimit n (10)
##
## The weight of spawning. This weight will be plused to the spawn-control
## score on every spawn. The higher this number is, the lower speed of spawning
## can be.
##
#SpawnScore n (1)
##
## The weight of termination. This weight will be plused to the score while
## fastcgi process terminates. The higher this number is, the lower speed of
## spawning can be.
##
#TerminationScore n (2)
##
## The max count of total fastcgi process count.
##
#MaxProcessCount n (1000)
##
## The maximum number of fastcgi application instances allowed to run for any
## one fastcgi application.
##
#DefaultMaxClassProcessCount n (100)
##
## The default environment variables before a fastcgi application is spawned.
## You can set this configuration more than once.
##
#DefaultInitEnv env_name env_value
##
## The connect timeout to a fastcgi application. Value in seconds.
##
## Default value: 2
##
#IPCConnectTimeout 10
IPCConnectTimeout 60
##
## The communication timeout to a fastcgi application. Please increase this
## value if your CGI have a slow initialization or slow respond. Value in
## seconds.
##
## Default value: 5
##
IPCCommTimeout 40
##
## CGI output cache buffer size. Value in kilobytes.
##
OutputBufferSize 64
#############################################
#▼ De Rerum Natura: MT-Dispatch-20071025 ▼#
#############################################
DefaultInitEnv MT_HOME /home/users/puplic_html/cgi-bin/mt/
DefaultInitEnv PERL_FCGI_Max_REQUESTS 250
DefaultInitEnv PERL_FCGI_CHILDREN 4
DefaultInitEnv PERL_FCGI_LOG /var/log/apache2/mt-dispatch.log
<Directory "/home/users/puplic_html/cgi-bin/mt">
AddHandler fcgid-script .fcgi
Options ExecCGI
allow from all
FCGIWrapper /home/users/public_html/cgi-bin/mt/plugins/MT-Dispatch/mt-dispatch.fcgi .fcgi
</Directory>
#############################################
#▲ De Rerum Natura: MT-Dispatch-20071025 ▲#
#############################################
##
##
## PHP via FastCGI
##
## uncomment the following line if you want to handle php via mod_fcgid
##
#<FilesMatch "\.php$">
# AddHandler fcgid-script .php
# FCGIWrapper /srv/www/cgi-bin/php5 .php
# Options +ExecCGI
#</FilesMatch>
##
</IfModule>
# End of <IfModule fcgid_module>
##
################################################################################
Apacheを再起動
# /etc/init.d/apache2 restart
エントリー編集で3秒ほどの保存時間が体感半分にはなっているようですが、apacheのmod_fcgidがすっきりしていません。 あくまでも参考として