本文介绍了你如何更改nginx返回的服务器头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个隐藏版本的选项,所以它只会显示nginx,但有没有办法隐藏它,所以它不会显示任何内容或更改标题?

There's an option to hide the version so it will display only nginx, but is there a way to hide that too so it will not show anything or change the header?

推荐答案

与Apache一样,这是对源代码的快速编辑和重新编译。来自:

Like Apache, this is a quick edit to the source and recompile. From Calomel.org:



## vi src/http/ngx_http_header_filter_module.c (lines 48 and 49)
static char ngx_http_server_string[] = "Server: MyDomain.com" CRLF;
static char ngx_http_server_full_string[] = "Server: MyDomain.com" CRLF;

2011年3月编辑:指出新选项,向下面的Flavius道具,用分叉的 HttpHeadersMoreModulerel =noreferrer> HttpHeadersMoreModule 。重新编译标准模块仍然是快速修复,如果您想使用标准模块并且不会经常更改服务器字符串,则有意义。但是如果你想要更多,那么HttpHeadersMoreModule是一个强大的项目,可以让你用你的HTTP头做各种运行时黑魔法。

March 2011 edit: Props to Flavius below for pointing out a new option, replacing Nginx's standard HttpHeadersModule with the forked HttpHeadersMoreModule. Recompiling the standard module is still the quick fix, and makes sense if you want to use the standard module and won't be changing the server string often. But if you want more than that, the HttpHeadersMoreModule is a strong project and lets you do all sorts of runtime black magic with your HTTP headers.

这篇关于你如何更改nginx返回的服务器头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 06:14