0

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;
    uwsgi_pass         127.0.0.1:8090;
}

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.

Akasha
  • 71
  • 1
  • 6

1 Answers1

0

Try this:

location = / {
    alias /home/appserver/tmp; # Alias is only for directories
    try_files index.html; # Always try to load index.html
}
Tero Kilkanen
  • 34,499
  • 3
  • 38
  • 58