iis路径指向网络存储_如何将您的域指向S3网站存储桶

iis路径指向网络存储

If you're hosting a static website in an S3 bucket and it's your first time buying a domain name, this simple guide is for you.

如果您要在S3存储桶中托管静态网站,并且这是您首次购买域名,那么此简单指南非常适合您。

摘要-您需要什么 (Summary - What You Need )

亚马逊S3 (Amazon S3)

  • Have an S3 bucket with the same name as your domain name

    有一个与您的域名同名的S3存储桶
  • Upload your website's code

    上载网站代码
  • Allow public access

    允许公众访问
  • Add a policy to enable S3 GetObject

    添加策略以启用S3 GetObject
  • Enable static website hosting

    启用静态网站托管

域名提供商 (Domain Name provider)

  • In your domain name's DNS Zone settings, delete all A records

    在域名的DNS区域设置中,删除所有A记录

  • In DNS Zone settings, add www to subdomain and the S3 endpoint in hostname for CNAME records

    在“ DNS区域”设置中,将www添加到子域,并在主机名中的S3终结点添加CNAME记录

Let's go through these steps one by one.

让我们一步一步地完成这些步骤。

步骤1:建立S3存储桶 (Step 1: Create an S3 bucket)

Create an S3 bucket to host your files for your website

创建一个S3存储桶以托管您网站的文件

First you need to create a bucket for your website. The name for your bucket must be the same as your domain name. Let's say we bought the domain name www.clarkngo.net. Then my S3 bucket's name should be www.clarkngo.net as well.

首先,您需要为您的网站创建存储区。 存储桶的名称必须与您的域名相同。 假设我们购买了域名www.clarkngo.net 。 然后,我的S3存储桶的名称也应该是www.clarkngo.net

After configuration, my endpoint should look similar to this:

配置后,我的端点应类似于以下内容:

http://www.clarkngo.net.s3-website-us-west-2.amazonaws.com

http://www.clarkngo.net.s3-website-us-west-2.amazonaws.com

Go to your AWS console and login. Choose S3.

转到您的AWS控制台并登录。 选择S3。

  1. Click Buckets

    点击

  2. Click Create bucket

    单击创建存储桶

3. Add your domain name in the bucket name

3.在存储桶名称中添加您的域名

4. You may choose any Region

4.您可以选择任何地区

创建S3存储桶和常规配置 (Creating the S3 bucket and general configuration)

Follow the checkboxes below and click Create Bucket.

遵循下面的复选框,然后点击创建存储桶

Only tick the following:

仅勾选以下内容:

  • Block public access to bucket and objects granted through new access control lists (ACLs)

    阻止对通过访问控制列表(ACL)授予的存储桶和对象的公共访问

  • Block public access to bucket and objects granted through any access control lists (ACLs)

    阻止对通过任何访问控制列表(ACL)授予的存储桶和对象的公共访问

将文件上传到S3存储桶 (Uploading files to the S3 Bucket)

1. Click Overview and Upload.

1.点击概述上传

2. Upload your website files in Select Files

2.在“ 选择文件”中上传您的网站文件

3. For Set permissions, hit Next.

3.对于设置权限 ,点击下一步

4. For Set properties, hit Next. (The default is Standard S3.)

4.对于设置属性 ,点击下一步 。 (默认值为Standard S3。)

5. For Review, hit Upload.

5.对于审阅 ,点击上传

编辑存储桶策略 (Editing the Bucket Policy)

1. Click Permissions, then Bucket Policy.

1.单击权限 ,然后单击存储桶策略

2. Add the policy. (Note: For your website you'll change arn:aws::s3:::www.clarkngo.net/*)

2.添加策略。 (注意:对于您的网站,您将更改arn:aws :: s3 ::: www.clarkngo.net/* )

{
    "Version": "2012-10-17",
    "Id": "Policy1548223592786",
    "Statement": [
        {
            "Sid": "Stmt1548223591553",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::www.clarkngo.net/*"
        }
    ]
}

3. Hit Save.

3.点击保存

静态网站托管 (Static website hosting)

1. Click Properties, then Static website hosting.

1.单击属性 ,然后单击静态网站托管

2. Choose Use this bucket to host a website.

2.选择使用该存储桶托管网站

3. For Index document, type index.html.

3.对于Index document,输入index.html

4. For Error document, type index.html.

4.对于错误文档,输入index.html

5. Hit Save.

5.点击保存

步骤2:将S3端点添加到您的域 (Step 2: Add the S3 Endpoint to your Domain)

编辑您的DNS区域 (Editing your DNS Zone)

  1. Login to your domain provider.

    登录到您的域名提供商。
  2. In this example, choose Name Servers/DNS, then Modify DNS Zone (or the equivalent).

    在此示例中,选择“ 名称服务器/ DNS” ,然后选择“ 修改DNS区域” (或等效名称)。

3. Remove all A records in your domain. Usually it will have a default IP address for a 404 Not Found page.

3.删除您域中的所有A记录。 通常,它将为404 Not Found页面提供默认IP地址。

4. Add a CNAME to point to the S3 Bucket:

4.添加一个CNAME指向S3存储桶:

  • add www for the Subdomain.

    为子域添加www

  • add www.clarkngo.net.s3-website-us-west-2.amazonaws.com (the S3 Endpoint) to the Hostname.

    www.clarkngo.net.s3-website-us-west-2.amazonaws.com (S3端点)添加到主机名。

And you're done! Note that it might take a while for your new settings take effect.

大功告成! 请注意,您的新设置可能需要一段时间才能生效。

Connect with me in LinkedIn here.

此处通过LinkedIn与我联系。

翻译自: https://www.freecodecamp.org/news/cjn-how-to-point-your-domain-to-s3-website-bucket/

iis路径指向网络存储

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值