I have researched this for a while but the use cases that others have asked about are more complex/different to what I am trying to achieve.
I have Nginx serving pages on both ports 80 and 443 for site, say example1.com. It works fine serving http and https. I now have a second server on my internal network running Apache. This is for a second site called, say example2.com. I have a single wan ip address with the A records of both sites pointing to it.
My router forwards ports 80 and 443 to the nginx server. I would like if Nginx could check if the request was for example1.com or example2.com and send example1.com, as now, to itself but just pass on all traffic for example2.com to the Apache server. As I have all the ssl certs properly set up on the example2.com Apache server, I am hoping that Nginx would just transparently pass on everything to Apache. I think I need proxy-pass. Do I also need to set up the same certs on Nginx or can it transparently pass all on to the apache server the same as if I had forwarded port 443 directly to it? A suggested config would be appreciated.