Nginx与https上的服务器名称不匹配

Nginx与https上的服务器名称不匹配,nginx,Nginx,我的nginx配置与我的https服务器不匹配,而是重定向到服务器ip server { listen 80 default_server; listen [::]:80 default_server; server_name www.example.de example.de; return 301 https://$server_name$request_uri; } server { listen 443 ssl default_server;

我的nginx配置与我的https服务器不匹配,而是重定向到服务器ip

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    server_name www.example.de example.de;

    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl default_server;
    listen [::]:443 ssl default_server;

    include snippets/example.conf;
    include snippets/ssl-params.conf;

    server_name www.example.de example.de;

    root /var/www/html;
    index index.php index.html;

    location / {
            try_files $uri $uri/ /index.php?q=$uri&$args;
    }

    location ~ /.well-known {
            allow all;
    }

    error_page 404 /404.html;

    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
            root /usr/share/nginx/html;
    }

    location ~ .php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+.php)(/.+)$;
            fastcgi_pass unix:/var/run/php/php7.0-fpm-butterbirne.sock;
            fastcgi_index index.php;
            include fastcgi.conf;
    }

    client_max_body_size 50m;
}
我在其中添加了默认的_服务器,因为一些答案表明匹配需要一个默认的_服务器。 Http在某种程度上是好的,但是它会重定向到机器ip。我将编写127.0.0.1而不是真正的ip

root@v22017043237047379:/etc/nginx# curl -I -L http://example.de
HTTP/1.1 301 Moved Permanently
Server: nginx/1.10.3
Date: Mon, 05 Jun 2017 08:30:09 GMT
Content-Type: text/html
Content-Length: 185
Connection: keep-alive
Location: https://www.example.de/

HTTP/1.1 301 Moved Permanently
Server: nginx/1.10.3
Date: Mon, 05 Jun 2017 08:30:10 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
X-Pingback: https://127.0.0.1/xmlrpc.php
Location: https://127.0.0.1/
Strict-Transport-Security: max-age=63072000; includeSubdomains
X-Frame-Options: DENY
X-Content-Type-Options: nosniff

curl: (51) SSL: certificate subject name 'example.de' does not match target host name '127.0.0.1'

nginx是1.10.3,os Debian Jessi

错误有所不同。错误来自wordpress。它被配置为侦听ip,而不是导致错误重定向的域。

错误与此不同。错误来自wordpress。它被配置为侦听ip,而不是导致错误重定向的域