After Nginx is installed, its version number is directly displayed by default. for security or privacy reasons, you may need to hide the Nginx version information. Hiding Nginx version information is very simple. you only need to modify a few files to implement it without affecting the running program. Take & ldquo; LNMP one-key installation package & rdquo; as an example. The Nginx Directory of the LNMP one-click package is:/usr/local/nginx.
After Nginx is installed, its version number is directly displayed by default. for security or privacy reasons, you may need to hide the Nginx version information. Hiding Nginx version information is very simple. you only need to modify a few files to implement it without affecting the running program.
Take the "LNMP one-click installation package" as an example.
The Nginx Directory of the LNMP one-click package is/usr/local/nginx. we need to modify the Nginx. conf, fastcgi. conf, and fcgi. conf files in the nginx directory. By default, such:
1. modify nginx. conf
In nginx. conf, locate the "http" field ().
Add the following parameters in the appropriate position (refer to the figure ):
server_tokens off;
Save it.
II. modify fcgi. conf
Find the following string:
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
And replace it:
#fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;fastcgi_param SERVER_SOFTWARE nginx;
The line "#" indicates the annotator.
3. modify fastcgi. conf
Find the following string:
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
Replace:
#fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
Save it. The line "#" indicates the annotator.
IV. test that nginx configuration is normal
/usr/local/nginx/sbin/nginx -t
Run the preceding command by using SSH, and the prompt "nginx: configuration file/usr/local/nginx/conf/nginx. conf test is successful" is displayed, indicating no pressure.
Then execute the following command to reload Nginx
service nginx reload
After the heavy load Nginx takes effect, for example, the software that uses the host header detection will not directly display the version number.