在 Ubuntu 中,您可以使用以下命令来重启 Apache2 服务:
打开终端(快捷键 Ctrl
+ Alt
+ T
)。
输入以下命令以重启 Apache2 服务:
sudo systemctl restart apache2
或者,您也可以使用以下命令:
sudo service apache2 restart
输入您的用户密码(如果需要),然后按回车键执行命令。
Apache2 服务将停止并重新启动。您可以通过以下命令检查 Apache2 服务的状态:
sudo systemctl status apache2
或者,您也可以使用以下命令:
sudo service apache2 status
如果 Apache2 服务正在运行,您将看到类似于以下的输出:
apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: active (running) since ...
现在,Apache2 服务已经成功重启。