Answer a question

I could not able to remove 'Server' header from response header of Nginx version 1.18 in Ubuntu 20.04 OS.

I have done the following steps:

  1. sudo apt-get update

  2. Installed nginx-extras by using command 'sudo apt-get install nginx-extras'

  3. Added the code snippet 'more_clear_headers Server;' in http section of nginx.conf file.

After restarting the Nginx service, it shows the error that 'unknown directive more_clear_headers'.

But, I could remove 'Server' header from response header of Nginx version 1.4.6 in Ubuntu 14.04 OS by doing the above steps.

Can anyone please help me how could I remove 'Server' header from response header of Nginx 1.18 in Ubuntu 20.04 OS?

Thanks In Advance

Answers

You should load the 'ngx_http_headers_more_filter_module.so' by adding the below code snippet in nginx.conf file.

load_module modules/ngx_http_headers_more_filter_module.so;

It will work.

Cheers!

Logo

开发云社区提供前沿行业资讯和优质的学习知识,同时提供优质稳定、价格优惠的云主机、数据库、网络、云储存等云服务产品

更多推荐