当前位置:   首页安装配置Nginx隐藏主机端各类信息的方法

Nginx隐藏主机端各类信息的方法

发布日期:2022-06-14 16:45 | 文章来源:站长之家

有时我们不希望有人可以通过一些工具来返回我们主机的信息,下面我来介绍在nginx中隐藏nginx响应头,修改nginx返回头信息,隐藏php版本号,隐藏主机信息,同学可参考。

首先隐藏nginx版本信息,只需编辑 nginx.conf 文件
添加一行

server_tokens off;
http {
  include    /etc/nginx/mime.types;
  default_type application/octet-stream;
  index index.php index.html index.htm;
  server_tokens off;
 
  log_format main '$remote_addr - $remote_user [$time_local] "$request" '
           '$status $body_bytes_sent "$http_referer" '
           '"$http_user_age

响应头隐藏PHP版本休息,编辑php.ini文件找到expose_php = On , 修改为 expose_php = Off

;;;;;;;;;;;;;;;;;
; Miscellaneous ;
;;;;;;;;;;;;;;;;;
; 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://www.php.net/manual/en/ini.core.php#ini.expose-php
expose_php = Off

联系我们
关于使用场景和技术架构的更多咨询,请联系我们的销售和技术支持团队。
Yingsoo Host

在线
客服

在线客服:7*24小时在线

客服
热线

400-630-3752
7*24小时客服服务热线

关注
微信

关注官方微信
顶部