A
A
alexan2015-03-11 21:11:58
Nginx
alexan, 2015-03-11 21:11:58

How to give an image from another folder in nginx if it is not in the current one?

Now the images are given like this: www.exmaple.com/img/xx123.png
img/ - the real directory relative to the root of the web server where the images are located. The name of the picture is always xxNNN.png, where xx is a non-changing character prefix, NNN is an integer.
It is necessary that if the xx123.png image is not in the img/ directory, nginx tries to serve it from some directory on the server that is not directly visible via the web, in which the images are with a different prefix in the file name, but with the same number.
For example, /home/myproject/myimg/yyy123.png
What directives and in what sections of the config should I add for this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2015-03-11
@mastedm

try_files

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question