Hide Nginx configuration version number

Configuration Nginx hidden version : [ Review source package (prior to installation); second: Modify Profile ]

curl -I http://192.168.100.171 // display nginx header information

[View the version number] to open the browser, press the F12 a development tool appears, there is a development tool in Network , click to find the access connection head to see the version

[Uninstall nginx :]

 

killall -9 nginx // kill the process

 

rm -rf / usr / local / nginx // clean installation

 

cd /usr/src/nginx-1.14.2/ // enter decompression path

 

make clean // clean up the build content (operating under the extraction path)

 

rm -rf /usr/src/nginx-1.14.2/ // delete extraction path

 

Modify source package]

 

tar xf nginx-1.14.2.tar.gz -C / usr / src / // decompression Source Package

 

cd /usr/src/nginx-1.14.2/ // enter decompression path

 

vim src / core / nginx.h // modify the document

 

 

 

Change file 1.14.2 and nginx

./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module && make && make install   //重新安装

curl -I http://192.168.100.171 // display nginx header information

systemctl stop firewalld

 

iptables -F

 

setenforce 0 // turn off the firewall

 

Modify Profile]

 

curl -I http://192.168.100.171 // view the current nginx header information

 

vim /usr/local/nginx/conf/nginx.conf // modify the configuration file

 

[ Ln -s /usr/local/nginx/conf/nginx.conf /etc/nginx.conf // make soft link]

 

vim /etc/nginx.conf // modify the configuration file

// adding file server_tokens off;

nginx -t // we detect whether there is a problem grammar

 

 

 

killall -HUP nginx // reload the configuration

curl -I http://192.168.100.171 // view the current nginx header information, then the version information has been hidden

 

 

Guess you like

Origin www.cnblogs.com/XXXX001/p/11515161.html