检查Apache服务状态
时间: 2023-10-22 17:07:17 浏览: 150
你可以使用以下命令检查Apache服务的状态:
```
systemctl status apache2
```
如果Apache正在运行,输出应该类似于以下内容:
```
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2021-04-08 11:07:03 UTC; 6 days ago
Docs: https://httpd.apache.org/docs/2.4/
Main PID: 1234 (apache2)
Tasks: 55 (limit: 4915)
CGroup: /system.slice/apache2.service
├─1234 /usr/sbin/apache2 -k start
├─5678 /usr/sbin/apache2 -k start
└─5679 /usr/sbin/apache2 -k start
```
如果Apache没有运行,输出应该类似于以下内容:
```
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Thu 2021-04-08 11:07:03 UTC; 6 days ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 1234 ExecStart=/usr/sbin/apache2 -k start (code=exited, status=0/SUCCESS)
Main PID: 1234 (code=exited, status=0/SUCCESS)
```
在这种情况下,您可以使用以下命令来启动Apache服务:
```
sudo systemctl start apache2
```
阅读全文