My question is similar to Proxy to "backend" service whenever a file does not exists, except that it should work for the root path as well, where I would like index.html to be returned.

Here is my current configuration:

location / {
    root /home/appserver/tmp/;
    try_files $uri.html @django;

location @django {
    include            uwsgi_params;

This works for everything, but the root (/) path where I would like to return index.html. I've

index index.html;

at the top of my server block.

I've tried

location = / {
    alias /home/appserver/tmp/index.html;

But this was never caught, and @django was reached instead.


Try this:

location = / {
    alias /home/appserver/tmp; # Alias is only for directories
    try_files index.html; # Always try to load index.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.