在 Ubuntu 上开启(启动)Apache2,通常步骤如下:
sudo apt update
sudo apt install apache2
sudo systemctl start apache2
sudo systemctl enable apache2
sudo systemctl status apache2
看到 active (running) 就说明已经开启。
在浏览器访问:
http://localhost
或服务器 IP,看到 Apache 默认页面即成功。
sudo systemctl stop apache2
sudo systemctl restart apache2
sudo systemctl reload apache2
如果你是要开启某个站点/虚拟主机或配置防火墙(ufw),也可以告诉我具体需求。