Is there a difference between nginx single or multiple server configuration?

Solution 1:

I have used both approaches in the past and both are valid configurations.

In the second approach, keep an eye out for missing paths in the URLs in your response to the client. You may need to use a rewrite or something similar. There are a several approaches to accommodate for this.

For example, if I request https://www.example.com/service1, the response from http://127.0.0.1:9002 needs to include the path /service1 so any subsequent requests will reach the intended service.