Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing 'server' header from response header of Nginx version 1.18 in Ubuntu 20.04

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

like image 775
Tijo Avatar asked Nov 01 '25 11:11

Tijo


1 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!

like image 61
Alex Avatar answered Nov 04 '25 03:11

Alex



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!