get hostname without subdomain in nginx config code example
Example: get hostname without subdomain in nginx config
# copy as it is do not replace domain with your domain name
server {
if ($host ~ ^www\.(?.+)$) {
return 301 $scheme://$domain$request_uri;
}
}