[Answer]-NGINX: Serve static files from different locations

1👍

I stumbled onto this while searching for something similar — how to serve a different filename than what’s requested. My final solution:

location /robots.txt {
       # Try the beta file, which has a disallow everything
       root /location/to/static/files;
       try_files /robots-beta.txt =404;
}
👤Berto

0👍

You can do a 302 Moved Temporarily redirect from the server which wants another one to serve the big files.

server_name serverA;
location /static/BIG/ {
    return  302 $scheme://serverB$uri;
}
👤cnst

Leave a comment