01 How To Use Nginx To Redirect All Traffic From Http To Https

Learn how to use Nginx to redirect all traffic from http to the more secure https in this LinuxConfig.org tutorial.

 

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.

In this guide, we'll assume you're already using NGINX on a Linux system and want to redirect all HTTP traffic to HTTPS. Even if a user happens to follow an https:// link, the site should send them to the correct and secured page, which happens instantly and without the user's intervention.