I started from https://gist.github.com/mattd/1006398 and now I have this:
root /data/example.com;
location /sites/default/files/ {
try_files $uri @proxy;
}
location / {
try_files @proxy;
}
location @proxy {
proxy_pass http://127.0.0.1:8088;
}
Of course, this is not valid syntax. How can I make this work? Basically, I want sites/default/files
to serve the file directly if it exists and use @proxy
otherwise. Other directories should go to @proxy
immediately. I do not want to copy-paste the @proxy
configuration because a lot more will be added there (caching). I will also have other directories that should be served directly for example .well-known
.
There are several ways to solve the problem:
1
You could put your proxy config to separate file and
include
it.proxy_conf
:and your config:
2
Use
error_page
directive:3
Use fake non-existent path as a first argument to
try_files
: