You are running Nginx as a webserver or reverse proxy, where you will be terminating SSL.
You are looking for the following functionality:
http://domain.com => https://www.domain.com
https://domain.com => https://www.domain.com
http://www.domain.com => https://www.domain.com
https://www.domain.com => https://www.domain.com