There are multiple ways to solve this. Depending how you are use case works. If you can blog
on the /blog
url itself then it can be the easiest thing to do
location /blog {
proxy_pass http://IP_ADDR_TWO:8015;
}
location /blog/static {
alias <App2 static path>;
}
If you can't do that then you can do something like below where you have common root folder of both apps
#browser caching of static assets
location ~* \.(jpg|jpeg|png|gif|ico|css|js|html)$ {
expires 7d;
root /home;
try_files /blog/server/$uri /app/server/$uri = 404;
}
This will first check file in blog and if it exists then it will return the same if not will check on the other path /ROOT_ONE
as per your question.
If both apps use same name for static files and with same paths then it could create error and serve wrong files.
In case you don't have static files on the same server from both apps then you can try something like below
#browser caching of static assets
location ~* \.(jpg|jpeg|png|gif|ico|css|js|html)$ {
expires 7d;
root /home;
try_files /app/server/$uri = @try_blogs;
}
location @try_blogs {
proxy_pass http://IP_ADDR_TWO:8015$uri;
}