重定向循环 - AWS ELB SSL Nginx

重定向循环 - AWS ELB SSL Nginx

我们在 ELB 上安装了 AWS 证书服务提供的证书,同时在 Nginx Web 服务器上配置了自签名证书。现在,当用户访问https://www.example.org/它说

www.example.org 重定向您太​​多次。ERR_TOO_MANY_REDIRECTS

以下是我的 nginx conf 文件

server {
    listen 80;
    listen 443 ssl;
    server_name example.org www.example.org *.example.org;

    access_log /var/www/example.org/logs/access.log;
    error_log /var/www/example.org/logs/error.log;
    root /var/www/example.org/httpdocs;

    ssl_certificate      /etc/nginx/ssl/new/example.org.crt;
    ssl_certificate_key  /etc/nginx/ssl/new/example.org.key;
    ssl_protocols        TLSv1 TLSv1.1 TLSv1.2;

    location / {
        index index.html index.php;
        try_files $uri $uri/ @handler;
        expires 30d;
    }

    location @handler {
        rewrite / /index.php;
    }

    location ~ .php/ {
        rewrite ^(.*.php)/ $1 last;
    }
    location ~ .php$ {
        if (!-e $request_filename) { rewrite / /index.php last; }

        expires        off;
        fastcgi_param  HTTPS $fastcgi_https;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
}

相关内容