0

Here is my nginx configuration file:

server {
    listen       80;
    server_name  domain.com;
    return 301 https://$host$request_uri;
}
server {
    listen       443;
    server_name  domain.com;
    client_max_body_size 20M;

    ssl_certificate           /path/cert.crt;
    ssl_certificate_key       /path/cert.key;

    ssl on;
    ssl_session_cache  builtin:1000  shared:SSL:10m;
    ssl_protocols  TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
    ssl_prefer_server_ciphers on;

    location / {
     proxy_pass http://localhost:9000/;

     proxy_set_header        X-Forwarded-Proto $scheme;
     proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
     proxy_set_header  Host $http_host;
     proxy_set_header  X-Url-Scheme $scheme;
     proxy_redirect    off;
     proxy_max_temp_file_size 0;

    }

    # Pagespeed
    location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" { add_header "" ""; }
    location ~ "^/ngx_pagespeed_static/" { }
    location ~ "^/ngx_pagespeed_beacon$" { }
    location /ngx_pagespeed_statistics { allow 127.0.0.1; deny all; }
    location /ngx_pagespeed_message { allow 127.0.0.1; deny all; }
}

Unfortunately I get a redirect loop. Can you please advice me any corrections?

glarkou
  • 7,023
  • 12
  • 68
  • 118
  • Tere is nothing in config that sends redirect. Check your backend – Alexey Ten Oct 19 '15 at 12:38
  • if I use #if ($http_x_forwarded_proto = "http") { return 301 https://$host$request_uri; #} it stops the redirects but it shows the default nginx page instead of the website – glarkou Oct 19 '15 at 12:52

0 Answers0