for root domain deployments, add a "." to the beginning of the hostname to match both apex and www requests. from http://nginx.org/en/docs/http/server_names.html:

A special wildcard name in the form “.example.org” can be used to match both the exact name “example.org” and the wildcard name “*.example.org”.