nginx proxy_pass using subfolder
Solution 1:
Since you tagged this as a reverse proxy question, I assume you mean that you want to proxy the request so that user only sees http://aaa.bbb.ccc.ddd/app2
URL in her browser.
You can change your location
block to this:
location ~/app2(.*)$ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://aaa.bbb.ccc.ddd:8001$1;
}
Here we capture the URI part after /app2
to $1
variable, and use it in the proxy_pass
directive.