无法从 aws 的 public ip 访问 apache 默认页面

unable to acess apache default page from public ip of aws

我在用户数据中提供了此代码,但无法加载具有以下 public IP 35.173.240.157 或当我尝试打开文本文档时的任何页面。 35.173.240.157/test.html

> #!/bin/bash 
> yum install httpd –y
> 
> service httpd start
>
> chkconfig httpd on
echo “<h1> Hi! This is bootstrapping!</h1>”>/var/www/html/test.html

我希望输出默认的 apache 页面应该被显示并且这个文本应该被访问 注意:我正在使用 ubuntu

我们需要知道错误在哪里。

所以登录EC2,检查你的命令是否成功执行,运行

service httpd status

如果出现错误,则表示未安装 httpd,这意味着您的文件可能未创建,因为目录不存在。

请检查:

ls -lrt /var/www/html

编辑:我了解到当您是 运行 一个 bootstrap 脚本时,您不需要成为 sudo。