Nginx load balance with upstream SSL

nginxssl

Trying to setup Nginx as load balancer for https servers. The upstream serves over port 443 with SSL certificates configured. How to configure Nginx, so that the SSL certificate configuration is handled only on the upstream servers and not in the Nginx server?

Best Answer

You need to use Upstream module, and Reverse Proxy module. To reverse proxy to the https upstream, use this

proxy_pass  https://backend;

where backend is an uptream block.

However, if I were doing this, I'd terminate ssl on the nginx server, and make upstream app servers doing what they are good at: serving the content, instead of worrying about ssl encryption/decryption overhead. Setting up ssl termination on nginx is also very simple using the SSL module. A very good case study is also given here.