centos

如何在 CentOS 上启动 Apache2

小樊
32
2025-03-19 15:46:15
栏目: 智能运维

在 CentOS 上启动 Apache2 服务,您需要执行以下步骤:

  1. 打开终端。

  2. 输入以下命令以安装 Apache2(如果尚未安装):

sudo yum install httpd
  1. 安装完成后,启动 Apache2 服务:
sudo systemctl start httpd
  1. 若要使 Apache2 服务在系统启动时自动运行,请执行以下命令:
sudo systemctl enable httpd
  1. 检查 Apache2 服务的状态,确保它正在运行:
sudo systemctl status httpd

如果 Apache2 服务正在运行,您将看到类似于以下的输出:

● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: active (running) since ...

现在,Apache2 已经在 CentOS 上启动并运行。您可以通过访问服务器的 IP 地址或域名来验证它是否正常工作。

0
看了该问题的人还看了