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/
阅读剩余
THE END