Ngnix301跳转将不带www跳转到带www(可用作多域名绑定一个web的情况)

if ( $host !~ ^www ) {
    return $scheme://www.$host$request_uri;
}

 

位置如图所示: