温馨提示×

centos apache2怎么重启

小樊
52
2026-07-20 09:39:59
栏目: 智能运维

CentOS 上,Apache 的服务名通常是 httpd(不是 apache2,apache2 是 Debian/Ubuntu 的叫法)。

一、重启 Apache(推荐)

sudo systemctl restart httpd

二、查看 Apache 状态

sudo systemctl status httpd

三、停止 / 启动

sudo systemctl stop httpd
sudo systemctl start httpd

四、设置开机自启(可选)

sudo systemctl enable httpd

五、如果你用的是 CentOS 6 或更早版本(无 systemctl)

sudo service httpd restart

六、确认 Apache 是否已安装

rpm -qa | grep httpd

httpd -v

如果你看到的是 apache2 而不是 httpd,说明你可能在用 Ubuntu/Debian,可以告诉我你的系统版本,我再帮你确认。

0