nginx https does not have www jump www settings
为情所困
为情所困 2017-05-16 17:08:48
0
3
654

nginx version

nginx version: nginx/1.10.2

It has been implemented that http://(www).airknow.com jumps to https://www.airknow.com, but https://airknow.com cannot be implemented to jump to https://www.airknow .com How to modify the configuration

The following is my configuration

server {
    listen 80;
    server_name airknow.com;
    return 301 http://www.airknow.com$request_uri;
}

server {
    listen 80;
    server_name www.airknow.com;
    return 301 https://www.airknow.com$request_uri;
}

server {
    listen  443;
    server_name  www.airknow.com;
    ssl on;
    #...
}    
为情所困
为情所困

reply all(3)
我想大声告诉你

When writing a 443 port, I solved it like this. Two 80 ports can be merged into one server_name www.xxx.com xxx.com

小葫芦

I tried adding a new server between the second server and the third server above

server {
    listen 443;
    server_name airknow.com
    return 301 https://www.airknow.com$request_uri;
}    

After restarting, the https://airknow.com website cannot be accessed.

左手右手慢动作

Same question as yours, found the answer

server {
    listen 443;
    server_name airknow.com
    return 301 https://www.airknow.com$request_uri;
}    

server {
    listen  443  default_server ssl;
    server_name  www.airknow.com;
   
}   

Like the above, add default_server ssl after 443 of the third server. I don’t know if there will be any negative effects

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template