在 CentOS 上,Apache 的服务名通常是 httpd(不是 apache2,apache2 多见于 Ubuntu/Debian)。
systemctl status httpd
输出中可以看到:
active (running) → 正在运行inactive (dead) → 未运行systemctl is-enabled httpd
enabled → 开机自启disabled → 不开机自启systemctl start httpd # 启动
systemctl stop httpd # 停止
systemctl restart httpd # 重启
ps aux | grep httpd
或
ps -ef | grep httpd
netstat -lntp | grep httpd
或(新系统)
ss -lntp | grep httpd
httpd -v
如果你确实安装的是 apache2(极少见),可以先确认:
systemctl list-unit-files | grep apache
然后对应使用:
systemctl status apache2
如果你是想确认 Web 是否能访问,也可以:
curl http://localhost
需要我帮你判断 Apache 是否安装、或排错启动失败吗?