nginx和php版本号隐藏

运维 · warm · 于 3年前 发布 · 1573 次阅读

概述

配置完一台服务器后,隐藏一些信息非常有必要,下面来介绍如何隐藏Nginx版本号以及PHP的版本号

1.隐藏Nginx版本号

打开nginx的项目配置文件

server {
    # ...省略一些配置
    server_tokens off;
  }

修改完成之后,别忘记启动nginx 检查配置文件并重启即可

nginx -t
systemctl reload nginx.service

2.隐藏php版本号

打开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
共收到 0 条回复
没有找到数据。
添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册