在 CentOS 中,默认使用的 Web 服务器通常是 Apache HTTP Server,服务名一般是 httpd(不是 apache2,apache2 常见于 Debian/Ubuntu)。
systemctl list-unit-files | grep httpd
或
rpm -qa | grep httpd
sudo systemctl restart httpd
# 启动
sudo systemctl start httpd
# 停止
sudo systemctl stop httpd
# 查看状态
sudo systemctl status httpd
# 开机自启
sudo systemctl enable httpd
sudo systemctl restart apache2
或
sudo service apache2 restart
sudo service httpd restart
如果你不确定是 httpd 还是 apache2,可以告诉我你的 CentOS 版本,我可以帮你确认。