在 CentOS 上,Apache 的服务名通常不是 apache2(那是 Debian/Ubuntu 的叫法),而是 httpd。以下是常用查看方式:
systemctl status httpd
输出示例:
active (running):正在运行inactive (dead):已停止systemctl is-enabled httpd
enabled:开机自启disabled:不开机自启service httpd status
ps aux | grep httpd
或
pgrep httpd
ss -lntp | grep :80
或
netstat -lntp | grep :80
httpd -v
httpdapache2(非官方源),请确认服务名:systemctl list-unit-files | grep apache
如果你是想 启动 / 停止 / 重启 Apache,也可以告诉我,我可以一并给你命令。