在 Ubuntu 上重启 Apache,常用以下几种方式(任选其一即可):
systemctl(推荐,适用于 Ubuntu 16.04 及以后)sudo systemctl restart apache2
service 命令(较老方式,仍可用)sudo service apache2 restart
sudo /etc/init.d/apache2 restart
sudo systemctl start apache2
sudo systemctl stop apache2
sudo systemctl reload apache2
sudo systemctl status apache2
sudo 权限。sudo apache2ctl configtest
ufw)。如果你是在 Docker / 云服务器 / 宝塔面板 环境下,也可以告诉我,我给你更具体的步骤。