Do you have enabled Letsencrypt for your domain? If yes, use command nano /etc/nginx/conf.d/force-ssl-example.com.conf
, where replace example.com with your domain. Edit line return 301 https://$host$request_uri;
to be exactly like this return 301 https://www\.$host$request_uri;
Save file, then use command nginx -t
for check if all is ok. If you dont have errors or warnings, use this command service nginx restart