G
G
gregorypetrov2017-05-30 14:19:50
Nginx
gregorypetrov, 2017-05-30 14:19:50

How to make nginx give Apache requests for non-existent files of a certain type?

Good afternoon, colleagues! Such a non-trivial task:
- there is a wordpress site that runs on an Apache server, which is proxied by nginx. Those. when requesting statics, nginx gives them immediately
- it is necessary that when requesting some types of static files (for example, .jpg, .png, .doc, .pdf) if these files exist - nginx gives them immediately (as is happening now), and if these files do not exist - would give these requests to the site so that wordpress displays a specific error page with special text).
How to do it? What rule in nginx configs is needed for this?
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Boris Korobkov, 2017-05-30
@gregorypetrov

try_files $uri $uri/ @php;
nginx.org/ru/docs/http/ngx_http_core_module.html#t...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question