I
I
Ivan Soshnikov2017-01-13 01:42:42
Nginx
Ivan Soshnikov, 2017-01-13 01:42:42

How to give a file from different directories by one URI?

There are several directories with files on the server.
The client requests a file at a single address.
How do I set up nginx to look for the requested file in my few directories. Preferably in the order that I would like to define.
I broke all the legs with named locations and rewrites, but I could not achieve the desired behavior :(
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
Wexter, 2017-01-13
@soshnikov

location / {
    try_files $uri $uri/ /dir/$uri /dir2/$uri /dir3/$uri = 404;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question