I set up SSL with letsencrypt option and everything is great except I cannont forward the non-www version of the ssl site to the www version. I tried adding
server_name domain.com;
return 301 https://www.domain.com$request_uri;
to the /var/www/domain.com/conf/nginx/ssl.conf
as well as the /etc/nginx/conf.d/force-ssl-.conf
but neither worked. The first one results in a redirect loop and the later outputs:
nginx: [warn] conflicting server name "domain.com" on 0.0.0.0:443, ignored
nginx: [warn] conflicting server name "www.domain.com" on 0.0.0.0:443, ignored
Any thoughts on how to make this happen?