sudo systemctl status nginx
时间: 2024-02-24 11:52:03 浏览: 27
sudo systemctl status nginx命令用于查看nginx服务的状态。它会显示nginx服务的运行状态、PID(进程ID)、启动时间、监听的端口等信息。
该命令的输出通常包括以下几个部分:
1. Active:显示nginx服务的当前状态,如active(正在运行)、inactive(未运行)等。
2. Main PID:显示nginx主进程的PID(进程ID)。
3. Started:显示nginx服务的启动时间。
4. Tasks:显示nginx服务的子进程数量。
5. Memory:显示nginx服务占用的内存信息。
6. CPU:显示nginx服务占用的CPU信息。
7. CGroup:显示nginx服务所属的CGroup信息。
8. Listening:显示nginx监听的端口和地址信息。
9. Document Root:显示nginx配置文件中指定的网站根目录。
如果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 Mon 2021-09-20 10:00:00 UTC; 1h ago
Docs: http://nginx.org/en/docs/
Main PID: 1234 (nginx)
Tasks: 2 (limit: 1137)
Memory: 3.4M
CGroup: /system.slice/nginx.service
├─1234 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
└─5678 nginx: worker process
Sep 20 10:00:00 server systemd[1]: Starting The nginx HTTP and reverse proxy server...
Sep 20 10:00:00 server nginx[1234]: nginx: [warn] could not build optimal types_hash, you should increase either types_hash_max_size: 2048 or types_hash_bucket_size: 64; ignoring types_hash_bucket_size
Sep 20 10:00:00 server systemd[1]: Started The nginx HTTP and reverse proxy server.
```