温馨提示×

ubuntu apache2怎重启

小樊
46
2026-09-29 08:34:32
栏目: 智能运维

在 Ubuntu 上重启 Apache2 通常使用 systemctl 命令(适用于 Ubuntu 16.04 及以后版本):

1. 重启 Apache2(推荐)

sudo systemctl restart apache2

2. 只重新加载配置(不中断连接,改配置后用)

sudo systemctl reload apache2

3. 停止 / 启动

sudo systemctl stop apache2
sudo systemctl start apache2

4. 查看运行状态

sudo systemctl status apache2

旧版本方式(兼容)

如果你用的是很老的 Ubuntu,也可以用:

sudo service apache2 restart

如果你是要修改配置后生效,一般 reload 就够了;如果是模块变更或不确定,就用 restart。

需要我帮你排查 Apache 启动失败或配置问题也可以说。

0 踩