Apache-2.2

如何更改 NGINX 伺服器名稱

  • September 6, 2013

在 Apache Web 伺服器中,我們可以使用 mod_rewrite 更改伺服器簽名(Apache 名稱)。

例如 - http://www.howtoforge.com/chang-apache-server-name-to-whatever-you-want-with-mod_security-on-debian-6

我將如何對 Nginx 做同樣的事情?我是 Nginx 的新手,想用我自己的簽名替換 Nginx 名稱。

我正在使用 Ubuntu 12.04 伺服器版。

對於 nginx,您需要在headers 中編譯更多模組(預設情況下不包含在 nginx 中)。這將允許您覆蓋Server:標題。

之後,您可以簡單地執行以下操作:

more_set_headers "Server: my_phone/1.0"

A. http://wiki.nginx.org/NginxHttpHeadersMoreModule#more_set_headers

B. 編輯原始碼並替換ngx_http_server_string

C。

$$ Beta $$使用 modsecurity D.

$$ not recommended $$使用 Varnish 或 Squid 之類的反向代理來隱藏標題(訪問 localhost 時標題將是可解析的)

引用自:https://serverfault.com/questions/536985