物理服务器名称的 Nginx 变量

标签 nginx

我正在尝试在我的单独 Web 服务器上设置响应 header ,以输出运行 nginx 的机器的物理名称,以便我可以知道哪些服务器正在为我们的 Web 客户端提供响应。

是否已经存在一个变量来执行此操作?还是我只需要在每个服务器上对其进行硬编码:(

最佳答案

您正在关注 $hostname公共(public)变量。 variable index 中列出了常用变量。 .

nginx access log documentation仅显示特定于访问日志的变量:

The log format can contain common variables, and variables that exist only at the time of a log write.

关于物理服务器名称的 Nginx 变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24915159/

相关文章:

performance - 多核/多处理器是否有助于 Web 服务器的性能?

css - Symfony2 : Stylesheets loaded but not applied on NGINX leading to broken error pages

docker - 无法通过 docker-letsencrypt-nginx-proxy-companion 启用 ssl

apache - 使用 Nginx Web 服务器时找不到 404

nginx - 如何为Nginx中丢失的favicon.ico文件返回204而不是404?

linux - 502 错误网关 Nginx

nginx - 在kibana中汇总http日志路径列表

Nginx动态位置配置

header - 如何在nginx中防止 "304 Not Modified"?

nginx - Centos 7上phpMyAdmin无法登录MySQL服务器