我的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;
}
我已经添加了default_server,因为有些答案表明匹配需要default_server。 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
答案 0 :(得分:0)
错误是不同的。错误来自wordpress。它被配置为侦听ip而不是导致错误重定向的域。