微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

四十二、LAMP与LNMP web架构深度优化实战-第一部

1.Nginx.conf配置文件基本参数优化

   1.1 隐藏Nginx header内版本号信息

             一些特定的系统及服务漏洞一般都和特定的软件版本号有关,我们应尽量隐藏服务器的敏感信息(软件名称及版本等信息),这样黑客无法猜到有漏洞的服务是否是对应服务的版本,从而确保web服务最大的安全。

     [[email protected] ~]# curl -I 192.168.0.102
     HTTP/1.1 200 OK
     Server: Nginx/1.6.2  --优化隐藏这个版本号
      Date: Fri,14 Jun 2019 08:25:07 GMT
      Content-Type: text/html
      Connection: keep-alive
     X-Powered-By: PHP/5.3.27

配置参数如下:

 [[email protected] ~]# cat /application/Nginx/conf/Nginx.conf 
worker_processes  1;
events {
    worker_connections  1024;
}
http {
    server_tokens off;
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
   
    include extra/www.conf;
   # include extra/bbs.conf;
    }

测试:

       }
[[email protected] ~]# /application/Nginx/sbin/Nginx -s reload
[[email protected] ~]# curl -I 192.168.0.102                 
HTTP/1.1 200 OK
Server: Nginx  --版本消失Date: Fri,14 Jun 2019 08:39:15 GMTContent-Type: text/htmlConnection: keep-alive

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐