相关文章推荐
卖萌的麦片  ·  [区块链] ...·  1 年前    · 
任性的大脸猫  ·  android - ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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 ?

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, 2018 at 23:39

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

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.