在 CentOS 上,Apache 的服务名通常是 httpd(不是 apache2,apache2 是 Debian/Ubuntu 的叫法)。
sudo systemctl restart httpd
sudo systemctl status httpd
sudo systemctl stop httpd
sudo systemctl start httpd
sudo systemctl enable httpd
sudo service httpd restart
rpm -qa | grep httpd
或
httpd -v
如果你看到的是 apache2 而不是 httpd,说明你可能在用 Ubuntu/Debian,可以告诉我你的系统版本,我再帮你确认。