nginx

How To Redirect HTTP to HTTPS in Nginx

A while back I moved my site to full-time TLS. This is great for users since it provides both security through an encrypted connection, and authentication to verify that what they’re getting is actually coming from me, without alteration or interception. However, I needed to make sure any requests to non-TLS locations were redirected to their new TLS-protected URL. Luckily Nginx makes this really simple. Here’s the code you need to add to your server configuration: