Here the scenario.
example.com server, serves either 80 or port depends on user's choice.
This server is to be moved behind an instance of Nginx which will act as reverse proxy (and load balancer) and shall serve HTTP and HTTPS accordingly.
Note:
- Setting the certificates int the Nginx should not be an issue.
- Nginx will communicate with the back-end server using HTTPS only if it currently serves HTTPS.
- Nginx to support multiple virtual hosts, (i.e. multiple domains).
Point is, all examples I have come across so far are dealing in cases where http and https are served in different sub-domains, e.g.
server_name www.example.com;
and
server_name secure.example.com;
Question is, what is the configuration for such case?