Amazon S3 static hosting with Namecheap DNS - How to correctly route non-www prefixed url

后端 未结 3 737
情书的邮戳
情书的邮戳 2021-01-30 09:11

I have been reading other posts to try to get down to the bottom of this issue... but I need some clarification.

I am able to get all of my domain requests to hit my Ama

3条回答
  •  春和景丽
    2021-01-30 09:20

    So I used jremi's answer but as mentioned below had issues with email being delivered. After some time with NameCheap support, I have a working solution.

    NameCheap setup

    CNAME Record          www   domain.com.s3-website-us-west-1.amazonaws.com.
    URL Redirect Record   @     www.domain.com  (unmasked)
    

    S3 setup (only need 1 bucket)

    [S3 Bucket] 
    Bucket name: www.domain.com     <---- This must match your domain exactly
    Static website hosting set to:
    "Enable website hosting"
    

    S3 bucket Policy

    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Sid": "PublicReadGetObject",
                "Effect": "Allow",
                "Principal": "*",
                "Action": "s3:GetObject",
                "Resource": "arn:aws:s3:::www.domain.com/*"
            }
        ]
    }
    

    This has allowed both domain.com and www.domain.com to work and my NameCheap email works as well.

提交回复
热议问题