17

I'm unable to find how I can map a single URL to a single static file. I tried:

location /feeds/seznam/ {
    alias /path/to/file/feed.xml;
}

but this does not work (in logs I see that it appends index.html to the path).

slm
  • 7,615
  • 16
  • 56
  • 76
Bruce
  • 407
  • 2
  • 6
  • 13
  • This [answer](http://serverfault.com/questions/278351/nginx-root-versus-alias-for-serving-single-files) for new readers – user21904 Sep 19 '15 at 10:23

1 Answers1

16

Try this instead:

location /feeds/seznam/ {
    rewrite ^/feeds/seznam/$ /path/to/file/feed.xml;
}

References

slm
  • 7,615
  • 16
  • 56
  • 76