Reverse proxy to another server

Hi all. Hopefully an easy question to answer.

I have two webservers behind a NAT. One is ERPNext. ERPNext obviously on Nginx. The other Apache. The apache is on a custom port so that I can access from outside the NAT using port forwarding. I would like to bring it back to 443 so that I can close as many ports as possible on the Firewall. Also neater not having to enter the port number.

Nginx from my understanding is very good at reverse proxying. Wondering if there is an easy way to forward a domain to the second server?

Second server also has an SSL certificate. Not sure if the Bench server should host this or the end server? Preferably the Bench server so renewals are one process. Would just need to point DNS behind the NAT so both domains point to the ERPNext server.

Thanks in advance.

If I understood you could try this:
Supposing to have server1 port 443 running on Nginx and server2 port 8443 running on Apache:

  • Set port forwarding to reach 443 on server1
  • Set up Nginx as a reverse proxy and forward all the requests for server2 to your internal ip+port where apache is running

Take a look also at this, maybe can help

Besides the use of ERPNext on one of your server, this is a networking and web server set up issue.
So, I would add that what is running on your web server is not influencing what you need to achieve (can be ERPNext or whatever else content served through a web server on port 80 or 443) because is mainly a matter or web server and router configuration.
I rather suggest you post this question also on