How to use Nginx to redirect all traffic from http to https - LinuxConfig.org

If your website is hosted with NGINX and it has SSL enabled, it's best practice to disable HTTP completely and force all incoming traffic over to the HTTPS version of the website. This avoids having duplicate content and ensures that all of the site's users are only browsing the secure version of your website. You should also see an SEO boost, as search engines prefer non-redundant and secured web pages.


This is a companion discussion topic for the original entry at https://linuxconfig.org/how-to-use-nginx-to-redirect-all-traffic-from-http-to-https