配置完一台服务器后,隐藏一些信息非常有必要,下面来介绍如何隐藏Nginx版本号以及PHP的版本号
打开nginx的项目配置文件
server {
# ...省略一些配置
server_tokens off;
}
修改完成之后,别忘记启动nginx 检查配置文件并重启即可
nginx -t
systemctl reload nginx.service
打开php的配置文件,php.ini,找到如下配置expose_php
; Decides whether PHP may expose the fact that it is installed on the server
; (e.g. by adding its signature to the Web server header). It is no security
; threat in any way, but it makes it possible to determine whether you use PHP
; on your server or not.
; http://php.net/expose-php
expose_php = On
将expose_php = On改为expose_php = Off 修改完成之后,重启php
sudo systemctl restart php-fpm