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?
相关问题
- PHP Empty $_POST
- How can I prevent my Shiny App from disconnecting
- Can't configure nginx as a proxy for tomcat wi
- How to set Nginx URI to fix empty URI in redirect
- Extract Location from Response Header with JMeter
Install Nginx Extras
Server details can be removed from response by adding following two lines in the nginx.conf (under http section)
There is a special module: http://wiki.nginx.org/NginxHttpHeadersMoreModule
If you're okay with just changing the header to another string five letters or fewer, you can simply patch the binary.
Which, as a solution, has a few notable advantages. Namely, that you can allow your nginx versioning to be handled by the package manager (so, no compiling from source) even if nginx-extras isn't available for your distro, and you don't need to worry about any of the additional code of something like nginx-extras being vulnerable.
Of course, you'll also want to set the option
server_tokens off
, to hide the version number, or patch that format string as well.I say "five letters or fewer" because of course you can always replace:
with
leaving the last two bytes unchanged.
If you actually want more than five characters, you'll want to leave server_tokens on, and replace the (slightly longer) format string, although again there's an upper limit on that length imposed by the length of the format string - 1 (for the carriage return).
...If none of the above makes sense to you, or you've never patched a binary before, you may want to stay away from this approach, though.
Simple, edit /etc/nginx/nginx.conf and remove comment from
Search for http section.
Are you asking about the Server header value in the response? You can try changing that with an add_header directive, but I'm not sure if it'll work. http://wiki.codemongers.com/NginxHttpHeadersModule