温馨提示×

Apache在Debian怎么启动

小樊
34
2026-08-20 10:34:22
栏目: 智能运维

Debian 系统里启动 Apache(通常是 Apache2),可以按下面步骤来:

1. 安装 Apache(如果还没装)

sudo apt update
sudo apt install apache2

2. 启动 Apache

sudo systemctl start apache2

3. 设置开机自启(可选)

sudo systemctl enable apache2

4. 查看运行状态

sudo systemctl status apache2

看到 active (running) 就说明启动成功了。

5. 常用管理命令

sudo systemctl stop apache2     # 停止
sudo systemctl restart apache2  # 重启
sudo systemctl reload apache2   # 重新加载配置(不中断服务)

6. 检查是否正常运行

在浏览器访问:

http://服务器IP

如果看到 Apache2 Debian Default Page,说明一切正常。

7. 常见端口问题

  • Apache 默认监听 80(HTTP)
  • 如果被占用或无法访问,可检查:
sudo ss -tlnp | grep 80
sudo ufw allow 80

如果你是在 Debian 11 / 12云服务器、或 Docker 里用,也可以告诉我,我可以给你更具体的说明。

0