如何使用nginx内置参数$ hostname

时间:2014-09-10 12:04:51

标签: nginx hostname built-in

documentation表示我们可以使用许多内置参数。但是当我在 nginx conf文件中使用$hostname时,它会在错误日志中抱怨:

  

2014/09/10 07:55:53 [emerg] 18902#0:无效的返回代码" $ hostname"

1 个答案:

答案 0 :(得分:0)

因为主机名不是状态代码。你最有可能寻找的是:

location /jump_to {
    internal;
    return 302 http://$arg_hostname/;
}

但这是一个有根据的猜测。如果仍然很糟糕,请指定您的目标。

相关问题