400 Bad Request nginx / 1.13.12

时间:2018-04-27 06:06:55

标签: docker ssl nginx

我收到" 400 Bad Request普通的HTTP请求被发送到HTTPS端口nginx / 1.13.12"在Nginx / Docker / SSL配置。下面是我在Nginx的Docker容器中的SSL配置。请帮忙。

server {
    listen          80;
    listen          443 ssl;
    server_name     mydomain.com;
    root            /usr/share/etc/nginx;
    index           index.html index.htm index.php;

    if ($scheme = http) 
    {
    return 301 https://$server_name$request_uri;
    }

     ssl on;
     ssl_certificate     /etc/ssl/certs/mydomain.crt;
     ssl_certificate_key /etc/ssl/private/mydomain.key;

     ssl_session_timeout 5m;


     location /{
            proxy_set_header Host $http_host;  
            proxy_set_header X-Forwarded-Host $http_host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For 
            $proxy_add_x_forwarded_for;
            proxy_set_header X-Scheme $scheme;

            proxy_pass                      http://localhost;
            proxy_read_timeout              180;

            proxy_redirect     off;
            proxy_redirect   http://localhost $scheme://mydomain.com;

            proxy_http_version              1.1;
            proxy_request_buffering         off;
    }    
}

0 个答案:

没有答案