systemctl はどれ(どこ)へのコマンド? nginx? OS? PHP-FPM?
#プログラミング #CLI、Shell
created: 2025/10/11,
modified: 2025/10/17
nginx や Apache などの管理するときに使う systemctl コマンド。何にでも使えるコマンドなの?そもそも何だろう
systemctl は「OS(Linux)」のサービス管理ツール(systemd のコマンド)です。
- 対象は「ユニット(service, socket, timer など)」で、nginx や PHP-FPM も“サービス”として管理されていれば対象になります。
- つまり「nginx 専用」や「PHP-FPM 専用」のコマンドではなく、OS 上の systemd が管理するあらゆるサービスに使うコマンドです。
例
- nginx を見る・操作する: sudo systemctl status nginx、sudo systemctl restart nginx
- PHP-FPM を見る・操作する: sudo systemctl status php8.1-fpm、sudo systemctl restart php8.1-fpm
- OS のブート時に自動起動設定: sudo systemctl enable nginx、sudo systemctl enable php8.1-fpm
ポイント
- systemctl は「どれへのコマンド?」→「Linux の systemd で管理される“サービス(ユニット)”全般」
- nginx も PHP-FPM も、systemd 管理下なら systemctl で制御できます。