要查找nginx服务的状态,可以使用以下命令:
sudo systemctl status nginx
这将显示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 Wed 2021-12-01 09:00:00 UTC; 1h ago
Docs: man:nginx(8)
如果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)
Docs: man:nginx(8)
如果nginx服务停止,您可以使用以下命令启动它:
sudo systemctl start nginx