Recently I had to find a solution to host multiple web applications on a Virtual Private Server (VPS). Both applications are accessed by different domain names, each of them using separate SSL certificates. In this post I explain how to configure Nginx to fulfill these requirements.
Currently, my preferred way to set up a Spring Boot based web application in production is to use a Reverse Proxy to route traffic to the corresponding backed applications. In this context, I really like Nginx as a fast and reliable web server with low memory footprint. The problem though, when using a reverse proxy is: when requests are forwarded to the backend applications, the remote IP address of the client is being replaced by the IP address of the reverse proxy server (e.g. 127.0.0.1 when installed on the same server).
To log requests and analyze user and behavioral patterns, it is beneficial to be able to use the remote IP address. This post explains how this can be achieved easily using Nginx.