在 CentOS 系统中,我们通常使用 systemctl
命令来管理 Apache 服务(httpd)
sudo systemctl start httpd
sudo systemctl stop httpd
sudo systemctl status httpd
sudo systemctl enable httpd
sudo systemctl disable httpd
请注意,CentOS 7 及更高版本使用的是 httpd
作为 Apache 服务的名称。如果你使用的是 CentOS 6 或更早版本,那么服务名称将是 apache2
。在这种情况下,请将上述命令中的 httpd
替换为 apache2
。