EC2でwordpress環境を、codeDeployで自動デプロイ時に「systemctl start httpd.service」
「systemctl start php-fpm.service」を実行するのだが、1度目は動いて、二度目は動かない
#httpd原因
#ログをコマンドで確認
vi /var/log/httpd/error_log
#ログ内容
[Mon Jul 19 13:41:39.413688 2021] [suexec:notice] [pid 3196] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Mon Jul 19 13:41:39.440099 2021] [lbmethod_heartbeat:notice] [pid 3197] AH02282: No slotmem from mod_heartmonitor
[Mon Jul 19 13:41:39.440194 2021] [http2:warn] [pid 3197] AH10034: The mpm module (prefork.c) is not supported by mod_http2. The mpm determines how things are processed in your server. HTTP/2 has more demands in this regard and the currently selected mpm will just not do. This is an advisory warning. Your server will continue to work, but the HTTP/2 protocol will be inactive.
[Mon Jul 19 13:41:39.566770 2021] [mpm_prefork:notice] [pid 3197] AH00163: Apache/2.4.48 () PHP/7.4.21 configured -- resuming normal operations
[Mon Jul 19 13:41:39.566799 2021] [core:notice] [pid 3197] AH00094: Command line: 'httpd'
「AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)」を見る限り、Apacheの公式を確認すると、削除すれば良いとのこと
#mvでファイル名を変更
mv /usr/sbin/suexec /usr/sbin/suexecbackup
#suexecがないこと、suexecbackupがあるか確認
ls /usr/sbin/suexec /usr/sbin/suexecbackup
#php-fpm原因
#ログをコマンドで確認
vi /var/log/php-fpm/error.log
#ログ内容
[19-Jul-2021 14:05:36] ERROR: Another FPM instance seems to already listen on /run/php-fpm/www.sock
[19-Jul-2021 14:05:36] ERROR: FPM initialization failed
調べたところ、[こちら](Plesk PHP FPM 7.0 service is down after switching to it from another FPM handler)を参考に暫定対応
vi /etc/systemd/system/plesk-php70-fpm.service
#記載内容
.include /lib/systemd/system/plesk-php70-fpm.service
[Service]
Restart= on-failure
RestartSec= 3
上記は暫定対応
できるだけ手作業は減らしたいので、初回起動以降も同じスクリプトを使えるかつ、エラーを無くすように対応予定