Updated on 2024-01-08 GMT+08:00

Installing Apache

Introduction

Apache HTTP Server (Apache for short) is a free open-source cross-platform web server software developed by the Apache Software Foundation. It can run in most operating systems and is widely used because of its high security. As one of the most popular web server software, Apache offers features such as support for FastCGI and SSL, and integration with Perl. This tutorial describes how you can deploy Apache in Huawei Cloud EulerOS 2.0.

Preparations

  • Prepare an ECS and assign a public IP address or EIP to the ECS.
  • Ensure that inbound security group rules allow traffic to flow to the ECS over port 80.

Procedure

  1. Install Apache.

    1. Run the following command to install Apache:
      dnf install httpd httpd-devel

      After the command is executed, the Apache configuration file is /etc/httpd/conf/httpd.conf.

    2. Run the following command to check the Apache version:
      httpd -v

      Information similar to the following is displayed:

      [root@localhost system]# httpd -v
      Server version: Apache/2.4.51 (Unix)
      Server built:   Feb  9 2022 09:00:41
    3. Run the following command to start Apache:
      systemctl start httpd

      If active (running) is displayed, Apache is started.

      To set Apache to automatically enable upon system boot, run the following commands in sequence:

      systemctl enable httpd
      systemctl daemon-reload

  2. Verify Apache.

    1. Run the following command to create a test page:
      echo test > /var/www/html/index.html
    2. Enter http://<Public IP address> in the address box of the browser. If the following figure is displayed, the deployment is successful.