* CentOS 5.2 でMTを動かす(MySQL編) [#h124b9ca]
CentOSはOS最小限でインストールした後、必要なパッケージをインストールします。
詳しくは割愛しますが、参考になれば。
#CONTENTS
** rpmforge の追加 [#z1d4dde7]
cat >> /etc/yum.repos.d/CentOS-Base.repo
-----
[rpmforge]
name = Red Hat Enterprise $releasever - RPMforge.net - dag
#baseurl = http://apt.sw.be/redhat/el5/en/$basearch/dag
mirrorlist = http://apt.sw.be/redhat/el5/en/mirrors-rpmforge
enabled = 0
protect = 0
rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
その他など、詳しくは、
- [[RPMforge/Using - RPMRepo Wiki:http://rpmrepo.org/RPMforge/Using]]
- [[Installing RPMforge:http://wiki.centos.org/AdditionalResources/Repositories/RPMForge]]
などを参照してください。
** パッケージインストール [#ma2b0ca0]
基本セットのインストールを行います。必要であれば、mysql-serverを入れてください。~
今回はDBは別のサーバを用意する前提で、パッケージの中には含まれていません。
''基本セットのインストール及びその周辺ツール''
yum install httpd httpd-devel libdbi-dbd-mysql make lv wget emacs
yum install php php-mysql php-mcrypt php-mbstring php-gd php-cli php-dba php-pear-Mail
''perl moduleのインストール''
(必要だと思ったものをインストールしていますが、必要のないものも含まれている可能性もあります)
yum install ImageMagick-perl mod_perl perl-IO-Zlib perl-URI newt-perl perl-IO-Socket-INET6 \
perl-Digest-HMAC perl-Archive-Tar perl-Net-DNS perl-HTML-Parser perl-IO-Socket-SSL perl-libwww-perl \
perl-Archive-Zip perl-XML-SAX perl-DBD-MySQL
rpmforgeのレポジトリからその他必要なperl moduleのインストール
yum install --enablerepo=rpmforge perl-Crypt-DSA perl-XML-Atom perl-Mail-Sendmail perl-GD perl-XML-RSS
** mod_fastcgiを設定する [#lbb50035]
MovableTypeは非常に重たいため、mod_firstcgiをインストールします。
fastcgiについては、[[http://fastcgi.com/:http://fastcgi.com/]]を参照してください。
buildに必要なため、シンボリックリンクを作成します。
cd /etc/httpd/
ln -s ../../usr/lib64/httpd/build
mod_fastcgiをダウンロード、及びパスの設定を行い、コンパイル及びインストールを行います。
mkdir /root/src
cd /root/src ; wget http://fastcgi.com/dist/mod_fastcgi-2.4.6.tar.gz
tar xvfz mod_fastcgi-2.4.6.tar.gz ; cd mod_fastcgi-2.4.6
sed 's/\/usr\/local\/apache2/\/etc\/httpd/g' Makefile.AP2 > Makefile
make
make install
** apacheの設定 [#bf73b276]
*** 基本設定 [#e3d45291]
基本的な設定は割愛します。~
私の場合は、VirtualHostを使用しないため、次のように設定を行いました。
<Directory "/home/www/htdocs">
Options Indexes FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
デフォルトでは、ExecCGIが有効になっていないため有効にします。
次に、cgi及びSSIを利用可能にします。(MTのSSI機能を使う場合に今後必要になる)
AddHandler cgi-script .cgi
AddType text/html .shtml
*** mod_fastcgi [#x919a910]
今回MTのみしか動かさないため、すべてのディレクトリでfastcgiを有効にしました。~
必要に応じて適時修正をしてください。
cat > /etc/httpd/conf.d/fastcgi.conf
---
<IfModule mod_fastcgi.c>
#AddHandler fastcgi-script .fcgi
AddHandler fastcgi-script .cgi
#FastCgiIpcDir /etc/httpd/fastcgi
FastCgiIpcDir /var/www/htdocs
</IfModule>
LoadModule fastcgi_module modules/mod_fastcgi.so
** DBの設定 [#hcaaf7f3]
データベースサーバで、次のようにして作成します。~
設定方法は一例ですので、必要に応じて設定を行います。
mysqladmin create tomo_mt -p
mysql> GRANT ALL PRIVILEGES ON tomo_mt.* TO tomo@10.17.0.12 IDENTIFIED BY '<password>';
mysql> flush privileges;
詳細は、[[データベースの設定(MySQL) | Movable Type 4 ドキュメント:http://www.movabletype.jp/documentation/database_option_mysql.html]]
をご覧ください。
** リバースプロキシの設定を行う [#j525ff9e]
%%MTでは、コントロールパネルの戻り先を正しくコントロールできないようですので、非常に面倒です。%%~
%%ある程度は、mt-config.cgiに記述を行えばよいですが、REQUEST-URIあたりを見ているのか、REQUEST-URIに戻してしまうため、IPアドレスでの指定はできません。リバースプロキシを行う元のサーバのhostsに、 10.17.0.12 mt.example.jp といったことを行ってやり、公開FQDN名でmod_rewriteでruleを設定してやる必要があります。%%
[[CGIPath:http://www.movabletype.jp/documentation/appendices/config-directives/cgipath.html]]及び[[AdminCGIPath:http://www.movabletype.jp/documentation/appendices/config-directives/admincgipath.html]]を設定すれば問題ないようで、ドキュメントには、CGIPath /cgi-bin/ と書いてありますが、http://example.jp/mt-test のように、URIで記述することができ、目的を果たすことが可能です。
&size(2){''もうちょっと、ドキュメントを親切に書いて欲しいなあ。。''};
*** ''公開サーバ側の設定例'' [#fc22520f]
ReverseProxyを行う公開サーバ側
RewriteEngine on
RewriteCond %{REQUEST_URI} /mt-test [NC]
RewriteRule ^/mt-test(/.*) http://mt.example.jp/MT4$1 [P]
*** ''localに設置するMTサーバ'' [#a1eb004f]
mt-config.cgiの設定を行います。
CGIPath http://mt.example.jp/mt-test
AdminCGIPath https://mt.example.jp/mt-test
StaticWebPath /mt-test/mt-static/
StaticFilePath /home/www/htdocs/MT4/mt-static
DefaultSiteURL http://mt.example.jp/mt-test
DefaultSiteRoot /var/www/htdocs/MT4/
TransparentProxyIPs 1
詳しくは、[[環境変数リファレンス | MovableType.jp:http://www.movabletype.jp/documentation/config]] をご覧ください。