在 Debian 系统上重启 Apache,常用以下几种方式(取决于你使用的 init 系统,现代 Debian 一般是 systemd):
sudo systemctl restart apache2
仅重新加载配置(不中断连接):
sudo systemctl reload apache2
查看状态:
sudo systemctl status apache2
sudo service apache2 restart
sudo /etc/init.d/apache2 restart
如果你只是修改了配置文件(如虚拟主机),可以用:
sudo apache2ctl graceful
或
sudo systemctl reload apache2
sudo apt install apache2
sudo apache2ctl configtest
如果你是在 Docker / LXC / 无 systemd 环境,告诉我具体环境,我可以给你更合适的方式。