在 CentOS 上,Apache 的服务名通常是 httpd(不是 apache2,apache2 多见于 Debian/Ubuntu)。
systemctl status httpd
active (running) 表示正在运行inactive (dead) 表示未运行systemctl is-enabled httpd
sudo systemctl start httpd
sudo systemctl stop httpd
sudo systemctl restart httpd
ps -ef | grep httpd
或
pgrep httpd
ss -lntp | grep :80
或
netstat -lntp | grep :80
curl http://localhost
如果你用的是 CentOS 6 或更早版本(无 systemctl):
service httpd status
service httpd start
如果你确认系统是 apache2 而不是 httpd,可以告诉我,我帮你进一步排查。