在 Debian 系统里启动 Apache(通常是 Apache2),可以按下面步骤来:
sudo apt update
sudo apt install apache2
sudo systemctl start apache2
sudo systemctl enable apache2
sudo systemctl status apache2
看到 active (running) 就说明启动成功了。
sudo systemctl stop apache2 # 停止
sudo systemctl restart apache2 # 重启
sudo systemctl reload apache2 # 重新加载配置(不中断服务)
在浏览器访问:
http://服务器IP
如果看到 Apache2 Debian Default Page,说明一切正常。
sudo ss -tlnp | grep 80
sudo ufw allow 80
如果你是在 Debian 11 / 12、云服务器、或 Docker 里用,也可以告诉我,我可以给你更具体的说明。