我安装在我的子域中的所有HTTP流量重定向到经过HTTPS,但我注意到,当我访问http://mydomain.com
它重定向到https://subdomain.mydomain.com
。 没问题,遇到的https://mydomain.com
。
只是为了澄清,
http://mydomain.com
不应该重定向但它currectly重定向到https://subdomain.mydomain.com
http://subdomain.mydomain.com
应该重定向到https://subdomain.mydomain.com
。
这是我的nginx的conf
server {
listen *:80;
server_name subdomain.mydomain.com;
server_tokens off;
root /nowhere; # this doesn't have to be a valid path since we are redirecting, you don't have to change it.
rewrite ^ https://$server_name$request_uri permanent;
}
server {
listen 443 ssl;
server_name subdomain.mydomain.com;
server_tokens off;
.... other stuff ...
}