How to change(Hide) the Nginx Server Signature?

前端 未结 5 1845
花落未央
花落未央 2020-12-28 14:44

I can hide Nginx version by using server_tokens option set to off. But not able to change the Nginx Server signature.

Steps I did,

1.) Change the Nginx serve

相关标签:
5条回答
  • 2020-12-28 15:11

    Go to nginx conf and switch off server_tokens.

    /etc/nginx/nginx.conf
    
    server_tokens off;
    
    0 讨论(0)
  • 2020-12-28 15:29
    1. Install HttpHeadersMoreModule - http://wiki.nginx.org/HttpHeadersMoreModule
    2. Change it using the more_set_headers directive.
    3. Reload Nginx to take effect.

      Hide nginx version information.

      server_tokens off;

      Change the server name.

      more_set_headers "Server: MyServerName";

    0 讨论(0)
  • 2020-12-28 15:30

    If you are working in ubuntu then

    1. First install nginx-extras

      sudo apt-get install nginx-extras
      
    2. Go to /etc/nginx/nginx.conf and under http add:

      http {
          more_set_headers "Server: Your_New_Server_Name";
          server_tokens off; 
      }
      
    3. Restart nginx

      sudo service nginx restart
      
    0 讨论(0)
  • 2020-12-28 15:32

    You can use this in your Nginx config.

    proxy_pass_header Server;
    
    0 讨论(0)
  • 2020-12-28 15:34

    If using ModSecurity v2.0 - v2.9, then in the .conf file you can use

    SecServerSignature SomeName
    

    ModSecurity v3 SecServerSignature has been deprecated, but I don't know if they replaced it with something else.

    0 讨论(0)
提交回复
热议问题