[英]Redirect https://www to https://
我嘗試將https://www.subdomain.website.com重定向到https ://subdomain.website.com-但我有“您的連接不是私有的”的信息,例如petenetlive.com/KB/Media/0000992/00001.png
沒有www也可以,因為它由Cloudflare管理。 你知道為什么嗎 ?
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";
}
}
我很確定您使用的證書不會涵蓋www.subdomain.example.com。 這意味着與該站點的https連接將導致SSL警告(主機名與證書不匹配)。 並且由於重定向僅在成功的SSL握手之后完成,因此不會發生重定向。
要解決此問題,您需要涵蓋www.subdomain.example.com的證書。 請注意,*。example.com的通配符證書是不夠的,因為通配符僅覆蓋主機名的最左側標簽。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.