0

I am trying to serve part of website from S3 (mydomain.com/frontend-beta).

I created bucket with name frontend-beta and enabled static web hosting with all necessary permissions. Also able to access http://frontend-beta.s3-website-us-east-1.amazonaws.com with out any error.

When I update nginx config from where main website (mydomain.com) is served and try to access mydomain.com/frontend-beta I get following error

404 Not Found
Code: NoSuchKey
Message: The specified key does not exist.
Key: frontend-beta/index.html
RequestId: 6A36E8E8DF29FBCC
HostId: SW2qCgYnhwHtXcDtD8saTIBV6YuExZ8dSZzZPedAYtagyVTq3O00BHAXAotknuF4rRUDJ1xeQYo=

in fact bucket/file does exist (frontend-beta/index.html), but don't know why its not able to access it.

here is my nginx config

http {
      upstream frontend-beta {
          server frontend-beta.s3-website-us-east-1.amazonaws.com;
      }
}
server {
        .
        .
        .

        location /frontend-beta/ {
           proxy_pass http://frontend-beta;
    }

}

Anyone know whats I am missing here ?

roy
  • 6,344
  • 24
  • 92
  • 174
  • `Key: frontend-beta/index.html` is not bucket + file in this error -- that's *just* the file, with its path *inside* the bucket. Nginx isn't removing that first prefix from the matched `location`. Your config needs to be written to strip that. You're confused because it happens to be the same string as your bucket name. – Michael - sqlbot Dec 12 '18 at 23:39

1 Answers1

0

Look at log file your key is wrong, so probably some redirection goes to index.html :

Key: frontend-beta/index.html

your key should match what is object name in S3

StefaDesign
  • 929
  • 10
  • 19