在 Debian 上安装 Apache2 非常简单,一般步骤如下:
sudo apt update
sudo apt install apache2 -y
sudo systemctl start apache2
sudo systemctl enable apache2
sudo systemctl status apache2
看到 active (running) 就说明成功了。
sudo ufw allow 'Apache'
# 或
sudo ufw allow 80/tcp
浏览器访问服务器 IP:
http://你的服务器IP/
看到 Apache2 Debian Default Page 即安装成功。
sudo systemctl stop apache2 # 停止
sudo systemctl restart apache2 # 重启
sudo systemctl reload apache2 # 重载配置
/var/www/html/etc/apache2/如果你需要 配置虚拟主机 / HTTPS / PHP,也可以继续问我。