Configure Nginx with HTTPS on a Linux VM when using Cloudflare as proxy

I’d like to get an Nginx server running on a Linux VM (hosted on Azure), and I’m routing traffic through Cloudflare for DNS and proxy. Now I’m looking to properly set up HTTPS, but I’m a bit unsure about the best approach when Cloudflare is in the middle.

Here’s what I’m trying to achieve:

  • Serve the site over HTTPS
  • Use Cloudflare for SSL offloading and DDoS protection
  • Make sure the connection between Cloudflare and my VM is encrypted too (end-to-end)

Now I’m stuck with:

  • How to setup Nginx on Linux VM properly?
  • And if anyone has a clean Nginx config example for this kind of setup, that would be super helpful.

Appreciate any guidance or best practices you’ve picked up from doing this before.

Read more here: Source link