~~I have a question for you seniors:
Today I enabled SSL support for the site. I want to do this:
No matter whether you visit https://domain.com or http://domain.com or http://www.domain.com, 301 automatically jumps to https://www.domain.com, that is to say, https://www.domain.com is the only access Url
. How should I write it? Configuration? This is how I do it:
But access will go wrong. Shows connection failure.
Remove
server {
listen 443;
server_name domain.com;
return 301...
}
This section can be accessed normally, but accessing https://domain.com will not jump to https://www.domain.com
Is there any solution?
~~
Resolved: https://www.iots.vip/post/ngi...
The connection failed. What is the http status code? I feel like there is nothing wrong with this configuration.
It’s no problem for me, this way, I can jump.
The connection has been reset. There is no status code.
Regarding the problem of domain.com jumping to www.domain.com, you can set it directly during domain name resolution
www A record 10.10.10.10
@ cname www.baidu.com. (remember there is a "dot" here)