隐藏Server的信息,Nginx版本号,在nginx.conf http段加上 server_tokens off就可以隐藏掉nginx的版本号
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server_tokens off;#隐藏掉nginx的版本号
server {
listen 80;
server_name www.buruyouni.com;
location / {
if (!-e $request_filename){
rewrite ^/(.*)$ /index.php/$1 last;
}
index index.php index.html index.phtml index.htm;
root /usr/local/nginx/html/yafcms/public;
}
location ~ .php(.*)$ {
root /usr/local/nginx/html/yafcms/public;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}
}
隐藏X-Powered-By:PHP/7.3.0
方法一:在php.ini文件关闭expose_php = On改成expose_php = Off
大约在370行,把expose_php = On 改成expose_php = Off
重新加载nginx配置文件,重启php,让配置生效
隐藏X-Powered-By:PHP/7.3.0
方法二 :在nginx配置文件添加:fastcgi_hide_header X-Powered-By;