[英]Redirect https://www to https://
I try to redirect https://www.subdomain.website.com to https://subdomain.website.com - but I have "Your connection is not private" like petenetlive.com/KB/Media/0000992/00001.png 我尝试将https://www.subdomain.website.com重定向到https ://subdomain.website.com-但我有“您的连接不是私有的”的信息,例如petenetlive.com/KB/Media/0000992/00001.png
It's ok without www because it's managed by Cloudflare. 没有www也可以,因为它由Cloudflare管理。 Do you know why ?
你知道为什么吗 ?
server {
listen 443;
server_name www.irc.mywebsite.lol;
return 301 https://irc.mywebsite.lol;
ssl on;
ssl_certificate /etc/nginx/ssl/server.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;
}
server {
server_name www.irc.mywebsite.lol;
rewrite ^(.*) https://irc.mywebsite.lol$1 permanent;
}
server {
# Port
listen 80;
# Hostname
server_name irc.mywebsite.lol;
# Logs (acces et erreurs)
access_log /var/log/nginx/irc.mywebsite.lol.access.log;
error_log /var/log/nginx/irc.mywebsite.lol.error.log;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header x-forwarded-for
$proxy_add_x_forwarded_for;
proxy_pass http://localhost:7778/;
proxy_redirect default;
# Websocket support (from version 1.4)
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
I'm pretty sure that the certificate you use does not cover www.subdomain.example.com. 我很确定您使用的证书不会涵盖www.subdomain.example.com。 This means the https connection to this sites results in a SSL warning (hostname does not match certificate).
这意味着与该站点的https连接将导致SSL警告(主机名与证书不匹配)。 And since the redirect is only done after the successful SSL handshake no redirect will happen.
并且由于重定向仅在成功的SSL握手之后完成,因此不会发生重定向。
To fix this you need a certificate which covers www.subdomain.example.com. 要解决此问题,您需要涵盖www.subdomain.example.com的证书。 Note that wildcard certificates for *.example.com will not be enough since a wildcard covers only the single leftmost label of the hostname.
请注意,*。example.com的通配符证书是不够的,因为通配符仅覆盖主机名的最左侧标签。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.