# non-www to www if ($host ~ ^(?!www\.)(?<domain>.+)$) { return 301 $scheme://www.$domain$request_uri; }