Tag Info

Hot answers tagged

7

You should almost always use $host, as it's the only one guaranteed to have something sensible regardless of how the user-agent behaves, unless you specifically need the semantics of one of the other variables. The difference is explained in the nginx documentation: $host contains "in this order of precedence: host name from the request line, or host name ...


1

That looks fine to me. No need to specify the IP addresses for the port 80 bindings, the hostnames are sufficient. You should be able to test this by just hitting the site with the different names. No need to URL rewrite either.



Only top voted, non community-wiki answers of a minimum length are eligible