Installing HTTP Web Server on EC2 | Scribe

    Installing HTTP Web Server on EC2

    • Hafeez Baig |
    • 18 steps |
    • 2 minutes
    information ordinal icon

    Refer to this guide to learn how to create an EC2 instance\ <https://scribehow.com/shared/AWS__Creating_your_first_EC2_Instance__Xcu7ZVCdRfWx56YVktKgbQ> Refer to this guide to learn how to connect to an EC2 instance<https://scribehow.com/shared/How_to_Connect_to_an_AWS_EC2_Instance__czXjLrH1R1yAIXika6fGbA>

    1

    Log in to the **EC2 Linux instance** by connecting through AWS default **EC2 instance connect**

    information ordinal icon

    Use **sudo** to switch from **ec2-user** to root for administrative tasks on EC2 Instance to mitigate the risk of unintended alterations affecting system stability or security.

    2

    Type [[sudo su]] to switch from **ec2-user** to root; followed by pressing Enter \ After sudo-ing to the root user trigger the **[[yum update]]** command to install any pending updates

    3

    Execute the [[yum install httpd]] command to install the httpd web server on the **Linux Instance**

    4

    After executing [[yum install httpd]]; the system will ask for the installation confirmation. Press "**y**" followed by an Enter to confirm the web server installation **Note:** To avoid asking for user confirmation you can execute the alternative command -[[ yum install httpd -y]]

    information ordinal icon

    Use this command [[echo "It works" &gt; /var/www/html/index.html ]]to create the HTML file

    5

    Start the web server by executing [[systemctl start httpd]]and then enable it to start automatically on every boot by executing[[systemctl enable httpd]]

    6

    Return to the Instances page in the Console Select the instance named - **First EC2 Instance** to view its details.

    7

    Scroll to the Instance overview section and click on the **Security** tab to access the EC2 instance security settings

    information ordinal icon

    **What is a security group?** A security group acts as a virtual firewall controlling inbound and outbound traffic for an AWS EC2 instance.

    8

    Update the security groups by clicking on the security groups **launch-wizard-1** link

    9

    On the security group page scroll to the **Inbound rules** section and click on the "**Edit inbound rules**" button

    10

    Click on the "**Add rule**" button and add a new rule by selecting "**HTTP**" in the Type dropdown

    11

    Select "**Anywhere-IPv4**" from the Source dropdown to allow incoming traffic from any ipv4 address

    12

    Click on the **Save rules** button

    13

    The Inbound rules in the Security group are successfully modified to allow incoming **HTTP** traffic

    14

    On the same page click on the **Instances** in the left bar to view the created instance

    15

    Select the instance named - **First EC2 Instance** to view its details

    16

    Scroll to the Instance overview section and copy the Public IPv4 address