使用 Init.d
依赖 /etc/init.d/ 脚本的 Linux 发行版可以使用以下三个命令中的任何一个来重新启动 Apache:
/etc/init.d/apache2 restart
sudo /etc/init.d/apache2 restart
sudo service apache2 restart
要执行正常重新启动,请将重新启动替换为重新加载。
对于 CentOS 和 RHEL 服务器 6.x 或者更早版本,请使用服务脚本,但不要将其称为 apache2,而是将其称为 httpd:
service httpd restart
在 Ubuntu、RedHat、Gentoo 和其他 Linux 发行版上重启 Apache
www. On IT Road .com
使用 Systemctl
较新的操作系统,如 Debian 8.x、Ubuntu 15.04、CentOS/RHEL 7.x 和更新版本,使用 systemd。
执行以下命令:
systemctl restart apache2.service
使用 Apachectl
apachectl 脚本提供了一种通用方法,旨在不知道特定服务器分布。
要执行它,我们必须以 root 用户身份运行它:
sudo apachectl -k restart
sudo apachectl -k graceful
优雅的方法graceful 类似于重新加载 reload方法。
日期:2020-07-15 11:16:54 来源:oir作者:oir