nginx http转https 301跳转

    server {
        listen    80;
        listen    [::]:80;
        server_name     _;

        access_log off;
        return 301 https://$host$request_uri;
    }

其中 _ 表示匹配所有未明确定义的主机名。