阅读量:0
有多种方法可以查看Nginx服务是否运行,以下是其中一种方法:
- 使用命令行工具:打开终端并输入以下命令来检查Nginx服务的运行状态:
sudo systemctl status nginx
如果Nginx服务正在运行,您将看到类似以下输出:
● nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2021-09-27 15:53:12 UTC; 1 day 5h ago Docs: man:nginx(8) Process: 2535 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS) Process: 2536 ExecStartPost=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS) Main PID: 2537 (nginx) Tasks: 2 (limit: 2295) CGroup: /system.slice/nginx.service ├─2537 nginx: master process /usr/sbin/nginx -g daemon on; master_process on; └─2538 nginx: worker process
如果Nginx服务未运行,您将看到类似以下输出:
● nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled) Active: inactive (dead) since Mon 2021-09-27 15:53:12 UTC; 1 day 5h ago Docs: man:nginx(8) Process: 2535 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS) Process: 2536 ExecStartPost=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS) Main PID: 2537 (code=exited, status=0/SUCCESS)
- 使用浏览器:您也可以尝试在浏览器中输入Nginx服务器的IP地址或域名来查看是否能够访问网站,如果能够正常访问网站,则Nginx服务正在运行。
无论使用哪种方法,都可以很容易地检查Nginx服务是否正在运行。