PowerCMS 7のインストール(その3)
1. PSGI環境の作成
PSGI は、Perl Web Server Gateway Interface の略で、アプリケーションサーバー上に永続化して動作するため、レスポンスがよくなります。
(1) Perlモジュールのインストール
# cpanm Plack
# cpanm Task::Plack
# cpanm XMLRPC::Transport::HTTP::Plack
# cpanm CGI::Parse::PSGI
# cpanm CGI::PSGI
# cpanm CGI::Compile
(2) Starmanのインストール
# cpanm Starman
# starman --version
(3) 手動での起動
まず手動で起動を行います。
# cd /var/www/mt
# starman \
--listen 127.0.0.1:5000 \
--workers 2 \
--max-requests 100 \
--pid /run/mt.pid \
./mt.psgi
別のSSHターミナルで確認します。
curl -I http://127.0.0.1:5000/mt/mt.cgi
以下のようになればOKです。
HTTP/1.1 200 OK
Pragma: no-cache
X-frame-options: SAMEORIGIN
Content-Type: text/html; charset=UTF-8
Date: Tue, 30 Jun 2026 22:49:28 GMT
Connection: keep-alive
Starmanを起動したSSHターミナルの方で「[Ctrl]+[C]」でStarmanを停止させます。
(4) Serviceファイルの作成
コマンドで起動できるようにServiceファイルを作成します。
# vi /etc/systemd/system/powercms-starman.service
[Unit]
Description=PowerCMS PSGI Starman
After=network.target mariadb.service
Wants=network.target
[Service]
Type=simple
User=apache
Group=apache
WorkingDirectory=/var/www/mt
RuntimeDirectory=powercms
RuntimeDirectoryMode=0755
Environment="PATH=/opt/perl-5.38.3/bin:/usr/local/bin:/usr/bin:/bin"
Environment="PERL5LIB=/var/www/mt/addons/PowerCMS.pack/extlib:/var/www/mt/addons/PowerCMS.pack/lib:/var/www/mt/extlib:/var/www/mt/lib"
Environment="PIDFilePath=/run/powercms/mt.pid"
ExecStart=/opt/perl-5.38.3/bin/starman \
--listen 127.0.0.1:5000 \
--workers 4 \
--max-requests 100 \
--pid /run/powercms/mt.pid \
--error-log /var/log/starman/powercms-starman-error.log \
./mt.psgi
ExecReload=/bin/kill -HUP $MAINPID
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
※「Environment="PATH=/opt/perl-5.38.3/bin:」や「ExecStart=/opt/perl-5.38.3/bin/starman」はperlのパスが異なる場合は実際のパス名に置き換えて下さい。
ログ・ディレクトリを作成します。
# mkdir -p /var/log/starman
# chown apache:apache /var/log/starman
# chmod 755 /var/log/starman
ログファイルも作成しておきます。
# touch /var/log/starman/powercms-starman-error.log
# chown apache:apache /var/log/starman/powercms-starman-error.log
# chmod 644 /var/log/starman/powercms-starman-error.log
サービスの反映・起動を行います。
# systemctl daemon-reload
# systemctl enable powercms-starman.service
# systemctl start powercms-starman.service
ステータスを確認します。
# systemctl --no-pager status powercms-starman.service
(4) mt-config.cgiの編集
# vi /var/www/mt/mt-config.cgi
末尾に追記します。
PIDFilePath /run/powercms/mt.pid
また、以下の内容を差し替えます。
#======== REQUIRED SETTINGS ==========
#CGIPath /mt/
#StaticWebPath /mt-static/
#StaticFilePath /var/www/html/mt-static
CGIPath https://www.example.jp/mt/
AdminCGIPath https://www.example.jp/mt/
StaticWebPath https://www.example.jp/mt-static/
StaticFilePath /var/www/html/mt-static
PowerCMSFilesDir /var/www/mt/pcms_files
※「www.example.jp」には実際のFQDNを入力して下さい。
(5) Apacheにリバースプロキシを設定
# vi /etc/httpd/conf.d/powercms.conf
[a] ALB(443)→EC2(80)の構成の場合
<IfModule mod_proxy.c>
ProxyRequests Off
ProxyPreserveHost On
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-SSL "on"
# mt-static は Apache が直接返す
ProxyPass /mt-static/ !
Alias /mt-static/ /var/www/html/mt-static/
<Directory "/var/www/html/mt-static">
Require all granted
</Directory>
# PowerCMS 本体は Starman へ
# 外部: https://www.example.jp/mt/mt.cgi
# 内部: http://127.0.0.1:5000/mt.cgi
ProxyPassMatch ^/mt/(mt(?:-[^/]+)?\.cgi)(.*)$ http://127.0.0.1:5000/mt/$1$2
ProxyPassReverse /mt/ http://127.0.0.1:5000/mt/
</IfModule>
[b] https(443)、http(80)が同一構成の場合
<VirtualHost *:80>
ServerName www.example.jp
RewriteEngine On
RewriteRule ^/(.*)$ https://www.example.jp/$1 [R=301,L]
</VirtualHost>
<VirtualHost *:443>
ServerName www.example.jp
ProxyRequests Off
ProxyPreserveHost On
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-SSL "on"
RequestHeader set X-Forwarded-Port "443"
Alias /mt-static/ /var/www/html/mt-static/
<Directory "/var/www/html/mt-static">
Require all granted
</Directory>
ProxyPassMatch ^/mt/(mt(?:-[^/]+)?\.cgi)(.*)$ http://127.0.0.1:5000/mt/$1$2
ProxyPassReverse /mt/ http://127.0.0.1:5000/mt/
</VirtualHost>
Apacheをリロードします。
# systemctl reload httpd.service
(6) PowerCMSでの確認
- PowerCMSにログインします。
- 「ツール」→「システム情報」をクリックします。
- 「サーバーモデル: PSGI」になっていればOKです。
2. PowerCMS 8341のインストール
- PowerCMS 8341のパッケージを解凍して、解凍したディレクトリに移動します。
# cd mt
# cp -r plugins/* /var/www/mt/plugins/
# chown -R www_user:apache /var/www/mt/plugins/
# cp -r mt-static/* /var/www/html/mt-static/
# chown -R www_user:apache /var/www/html/mt-static/
# cp tools/* /var/www/mt/tools/
# chown -R www_user:apache /var/www/mt/tools/
- PowerCMSにログインします。
- 「設定」-「プラグイン」で「PowerCMS 8341」を有効にします。
最終更新:2026年07月09日 09:28