在 Ubuntu 上启动 Apache2 通常有以下几种方式(假设你已经安装好了 apache2):
sudo systemctl start apache2
设置开机自启:
sudo systemctl enable apache2
查看运行状态:
sudo systemctl status apache2
sudo service apache2 start
停止 / 重启:
sudo service apache2 stop
sudo service apache2 restart
在浏览器访问:
http://localhost
或服务器 IP,看到 Apache2 Ubuntu Default Page 就说明成功了。
sudo apt update
sudo apt install apache2
如果你遇到 端口被占用 或 启动失败,可以把 systemctl status apache2 的输出发我帮你看。