ubuntu怎么重启apache

重启Apache只有两个命令:
现有方法使用: sudo /etc/init.d/apache2 restart 先停下来,再开始。
旧版本使用此:
现在推荐以下内容: sudo systemctl 重新启动 apache2 它非常高效并且允许您管理依赖关系。

您可以继续使用以前版本的系统。
sudo 服务 apache2 重新启动 其实和现有的方法一模一样。

注意:您必须使用 sudo。
如果您的配置不正确,请首先运行 sudo apachectl configtest。
如果您不确定,请查看 /var/log/apache2 /error.log。

您想停止服务吗? sudo systemctl stop apache2
您想启动该服务吗? sudo systemctl start apache2
这是旧版本吗? 1 6 .04 之后使用systemctl。

如何重启apache2 服务

使用 sudo systemctl start apache2 启动 Apache 服务。
sudo systemctl restart apache2 重新启动 Apache 服务。
要停止 Apache 服务,请使用 sudo systemctl stop apache2