I tried to change the value of the $host variable to $http_x-real-host:
set $host $http_x-real-host;
In response, I receive a message like:
11:53:51 [emerg] 12781#12781: the duplicate "host" variable in /tmp/nginx/nginx-cfg350749497:710
I can’t find any restrictions are imposed on the redefinition of core variables in nginx...