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 you how to redirect in the other direction, from a non-www URL to www.
Configure DNS Records
In order to set up the desired redirect,
example.com or vice versa, you must have an A record for each name.