在 Ubuntu 上启用 Apache(通常指 Apache2)一般步骤如下:
sudo apt update
sudo apt install apache2
sudo systemctl start apache2
sudo systemctl enable apache2
sudo systemctl status apache2
看到 active (running) 说明已启用并运行。
sudo ufw allow 80
# 如需 HTTPS
sudo ufw allow 443
然后浏览器访问:
http://服务器IP
看到 Apache2 Ubuntu Default Page 即成功。
sudo systemctl stop apache2 # 停止
sudo systemctl restart apache2 # 重启
sudo systemctl reload apache2 # 重新加载配置
如果你是指 启用某个站点 / 模块(如 rewrite、ssl),也可以告诉我具体需求。