I'm running a Synology NAS with DSM 5.x. I finally have a working nginx reverse proxy from another server with the below configuration.
What I don't want is all the locations, if possible. The DSM web interface uses each of the below url fragments as part of it's interface. There's no URL base, and no option to add one.
My question is-- is it possible in nginx with proxy_pass or proxy_redirect or rewrite (or something else) to not have to list all the separate locations individually? (I've tried dozens of combinations of these for several days, and was never able to get anything except the below to work.)
nginx.conf
http {
upstream dsm {
server 1.1.1.1:5000;
}
server {
location /dsm/ {
include proxy_headers;
proxy_pass http://dsm/;
}
location /scripts/ {
include proxy_headers;
proxy_pass http://dsm;
}
location /synoSDSjslib/ {
include proxy_headers;
proxy_pass http://dsm;
}
location /webapi/ {
include proxy_headers;
proxy_pass http://dsm;
}
location /webdefault/ {
include proxy_headers;
proxy_pass http://dsm;
}
location /webfm/ {
include proxy_headers;
proxy_pass http://dsm;
}
location /webman/ {
include proxy_headers;
proxy_pass http://dsm;
}
}
}
proxy_headers
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
Edit: Let me clarify-- I did leave out a few details. I would like a single address & port with multiple base url's that can reach multiple DSM's without base url's like /scripts & /webapi from clashing/colliding/colluding. I know that multiple addresses & ports are possible. What I'm looking for, if it's possible, is a way to ssh into the server serving nginx with a -L local forward, forwarding a single port, so that I can reach multiple DSM's with one single ssh forwarded port. The solution I have now does work, but only for one DSM. If I add a 2nd, they collide.