How to host a static website in an EC2 instance?
We need to go through the following steps to host a static website in an EC2 instance in AWS Cloud. The steps are as follows:
2. To configure a HTML website, we need to go to a HTML folder where we can configure/manage the files. The command is:
cd /var/www/html
3. Create a new file named index.html by typing : vi index.html.
Go to insert mode by pressing 'i' and add some content in the file. Exit from the file once the content is added by typing Esc+shift+:+wq.
4. Start and enable the httpd service by typing the command:
systemctl start httpd
systemctl enable httpd.
5. Go to the instance settings and open the security tab.
Click on Edit Inbound Rules-> Add a rule for the protocol HTTP(Port 80) and allow access for anywhere IPV4.
6. Open a new tab on Google chrome and paste the EC2 instance public IPV4 address and mention the file name as follows:
<IP-Address>/<file name.html>
A static website on an EC2 instance using the Apache Server(HTTPD package) is hosted successfully.