How to disable nginx server header?
2024-03-17
I am running nginx on my own laptop and i am using Pop!_OS 22.04 LTS
pre-requisites
- install nginx
- have knowledge on how to edit nginx configuration file
Install nginx-extras
If you have installed nginx with apt
package manager, you have to install the following package to disable the server header.
Edit nginx configuration file
Open the nginx configuration file in your favorite text editor. The default location of the configuration file is /etc/nginx/nginx.conf
. Add the following line to the http
block.
You can also addd it to
server
and location
block And then restart the nginx server.
check the server header using curl
And also check the server header using browser developer tools.