1 amazon-ec2 amazon-web-services
下面的脚本有什么问题?\n我无法访问该站点并显示“无法访问此站点\xe2\x80\x99”错误
\n #!/bin/bash\n# Use this for your user data (script from top to bottom)\n# install httpd (Linux 2 version)\nyum update -y\nyum install -y httpd.service\nsystemctl start httpd.service\nsystemctl enable httpd\necho "<h1>Hello World from $(hostname -f)</h1>" > /var/www/html/index.html\n
Run Code Online (Sandbox Code Playgroud)\n
正确的UserData
是(一开始也有空间):
#!/bin/bash
# Use this for your user data (script from top to bottom)
# install httpd (Linux 2 version)
yum update -y
yum install -y httpd
systemctl start httpd
systemctl enable httpd
echo "<h1>Hello World from $(hostname -f)</h1>" > /var/www/html/index.html
Run Code Online (Sandbox Code Playgroud)
您还需要确保实例位于公共子网中、具有公共 IP 且其安全组允许连接到端口 80。
归档时间: |
|
查看次数: |
1121 次 |
最近记录: |