Redirect www to non-www with Nginx
This tutorial will show you how to redirect a www URL to non-www, e.g., www.example.com to example.com, with NGINX. We will also show how to redirect the other way, from a non-www URL to www. While the examples are based on CentOS, the steps are pretty much the same for any OS.