What is the difference between the three Nginx variables $host
, $http_host
, and $server_name
?
I have a rewrite rule where I'm not sure which one I should be using:
location = /vb/showthread.php {
# /vb/showthread.php?50271-What-s-happening&p=846039
if ($arg_p) {
return 301 $scheme://$host/forum/index.php?posts/$arg_p/;
}
I'm looking for an answer that doesn't just say 'use ___ variable in your rewrite rule' but also explains the theoretical differences between them.