Serving websites from S3

Justin Cormack justin at
Thu May 19 13:16:34 MSD 2011

On Wed, 2011-05-18 at 15:40 -0700, Nicholas Wieland wrote:
> Hi guys, I've tried to ask pretty much everywhere, but no solution
> until now. I'm quite sure I'm doing something wrong here, but to be
> honest I'm not able to catch it.
> I'm rewriting urls from to
>, and everything works like a charm.
> If I point the browser to nginx serves my
> static website exactly as I want. The problem I'm facing now is that
> I'm not able to have nginx serve my index.html by default, while
> retrieving
> I've tried both try_files and index so far, with no result. I've also
> tried to catch 404s and serve my index.html page (even though I guess
> this is a bad practice).
> This is what I have right
> now:
> Can someone help me? I'm a bit out of ideas.
> What is really strange to me is that (real example)
> answers with a 404, I really have no idea why
> try_files doesn't work... Maybe $url/index.html is not right and I
> should use another syntax?

You know that Amazon added support for index files to S3?

Try_files does not work because it looks for acrual files on your file
system, and thats not where S3 is! You can use two locations, one to
match just / and one to match all other files.


More information about the nginx mailing list