LinuxでNginxの起動状態を確認する方法は?

nginxの起動状態を確認するには、以下のコマンドを使用できます:1. `systemctl`コマンドを使用する(systemdで管理されているシステムに適用)。

  systemctl status nginx

nginxの現在の状態、稼働中かどうか、および稼働時間が表示されます。2. `service`コマンドを使用する(initで管理されているシステム向け)。

  service nginx status

nginxの現在の状態、実行中かどうか、および実行時間を表示します。 3. `ps`コマンドを使用してnginxプロセスを検索します。

  ps aux | grep nginx

このコマンドは、nginxプロセスの詳細情報を表示します。プロセスID(PID)や起動コマンドなどが含まれます。nginxが実行中であれば、以下のような出力が表示されます。

nginx.service - The nginx HTTP and reverse proxy server

Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)

Active: active (running) since Wed 2022-02-09 09:35:57 UTC; 3s ago

Docs: http://nginx.org/en/docs/

Main PID: 12345 (nginx)

Tasks: 2 (limit: 2361)

Memory: 3.2M

CGroup: /system.slice/nginx.service

├─12345 nginx: master process /usr/sbin/nginx -g daemon on; master_process on

└─12346 nginx: worker process


Nginxが実行されていない場合、以下のような出力が表示されます。

nginx.service - The nginx HTTP and reverse proxy server

Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)

Active: inactive (dead)

Docs: http://nginx.org/en/docs/


        
bannerAds