centos

centos apache2如何启动与停止

小樊
44
2025-07-16 18:30:19
栏目: 智能运维

在 CentOS 系统中,我们通常使用 systemctl 命令来管理 Apache 服务(httpd)

  1. 启动 Apache 服务:
sudo systemctl start httpd
  1. 停止 Apache 服务:
sudo systemctl stop httpd
  1. 查看 Apache 服务状态:
sudo systemctl status httpd
  1. 设置 Apache 服务开机自启:
sudo systemctl enable httpd
  1. 取消 Apache 服务开机自启:
sudo systemctl disable httpd

请注意,CentOS 7 及更高版本使用的是 httpd 作为 Apache 服务的名称。如果你使用的是 CentOS 6 或更早版本,那么服务名称将是 apache2。在这种情况下,请将上述命令中的 httpd 替换为 apache2

0
看了该问题的人还看了