Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (29.3k points)

I gave this code in user data but not able to load any page with the following public IP or when I tried to open a text document.

> #!/bin/bash 

> yum install httpd –y

> service httpd start

> chkconfig httpd on

echo “<h1> Hi! This is bootstrapping!</h1>”>/var/www/html/test.html

enter image description here

here I expect the output that default apache page should be displayed and this text should be accessed note: I am using ubuntu

1 Answer

0 votes
by (50.2k points)

First, for this query, we need to know where the error is and to find that issue so log in to EC2, check if your commands were successfully executed, by running

service httpd status

if you get an error, httpd was not installed, and that means your file was probably not created, as the directory was not present.

And also do check that with:

ls -lrt /var/www/html

Browse Categories