在 Ubuntu 上开启(启动)Apache,通常步骤如下:
sudo apt update
sudo apt install apache2
sudo systemctl start apache2
sudo systemctl enable apache2
sudo systemctl status apache2
看到 active (running) 就说明已经开启。
sudo ufw allow 'Apache'
或只开放 80 端口:
sudo ufw allow 80/tcp
在浏览器打开:
http://localhost
或服务器 IP:
http://你的服务器IP
看到 Apache 默认页面即成功。
sudo systemctl start apache2 # 启动
sudo systemctl stop apache2 # 停止
sudo systemctl restart apache2 # 重启
sudo systemctl reload apache2 # 重载配置
如果你是 Ubuntu 14.04 及更早版本,用:
sudo service apache2 start
需要我帮你配置虚拟主机或 HTTPS 也可以继续问。