I switched to nginxproxy from apache to benefit from the speed on my shared hosting production server.
I have a few domains with SSL enabled and suddenly the sites were in a endless loop and they would not display.
I traced the problem to php checking $_SERVER['HTTPS'] - which behind nginx proxy apache does not know it is https being served.
I was pulling my hair out trying to get this to work - but php was getting environment and server variables from apache which doesn't know nginx is sending ssl pages.
The fix is simple! YET I hope I save someone the trouble I had with this.
ssh:
/home/nginx/conf/globals
if you are using a custom.proxy.conf just add the below lines, if not we must create it:
cp proxy.conf custom.proxy.conf
vim custom.proxy.conf
Find all the lines where it says proxy_set_header and add this line:
proxy_set_header X-Forwarded-Protocol $scheme;
Then go to the directory of the website having the endless ssl loop due to a php redirect.
Example:
if ($_SERVER['HTTPS'] !== on) {
// redirect to https here ----
Add this to the .htaccess of the domain with ssl:
SetEnvIf X-Forwarded-Protocol https HTTPS=on
sh /script/fixweb
sh /script/restart-all
All fixed

This is for those who understand php programming and ssl redirect being forced through php headers.
Everyone else

this doesn't apply....
Enjoy