'nginx reverse proxy settings for app in a subfolder

I'm very new to nginx and I was tasked with building a reverse proxy with a few services. So far so good, but my next assignment was for the reverse proxy to have a setting for an that we have on 192.168.0.16/app to be accesible from app.domain.com.

The nginx settings I've tried so far are:


server_name app.mydomain.com;
location / {
       proxy_pass          http://192.168.0.16/app;
}

Which gives me 404 not found,


server_name app.mydomain.com;
location / {
       proxy_pass          http://192.168.0.16/app/;
}

Which also gives 404 not found but the IIS server gives a little more info: URL requested:

http://app.mydomain.com:80/app/APP/Account/Login?ReturnUrl=%2fapp%2f

So it's redirecting twice or entering a directory it shouldn't.

I appreciate any insight!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source