In nginx when using the rewrite rule for domain.com to www.domain.com
Ssl might cause your ssl with nginx to go into a endless loop.
By adding the following rule this should resolve your problem.
This can easily be resolved by editing your backend conf and adding the following to your fastcgi parameters
fastcgi_param HTTPS on;
Just restart nginx and now SSL shouldn’t cause anymore loops.
Now verify that your none www. redirects correctly over ssl ..