1.2017年连续爆出5.x版本xshell安全问题和intel的cpu设计漏洞 ,此时我就注意到尽可能少暴露本身线上使用的工具以及版本。例如:mysql版本,以及缓存层策略,服务器版本等,如下为 隐藏 nginx的版本号方法:html
nginx配置中:node
http段中,加入配置mysql
server_token off;nginx
或者修改源码中,字符串定义。编辑src/core/nginx.h, web
sql
shell
缓存
安全
服务器
sendfile on|off;
配合 tcp_nopush|tcp_nodelay 防止网络I/O阻塞,提高效率
tcp_nopush on;
tcp_nodelay on; //激活延时,提升I/O功能
4.链接超时设置
keeplive_timeout 90; //客户端链接 保持会话
client_header_timeout //设置读取客户端请求头数据的超时时间
send_timeout 40; //指定相应客户端的超时时间
5.nginx gzip压缩配置
gzip on; gzip_min_length 1000; //容许压缩的页面最小字节数 gzip_proxied expired no-cache no-store private auth; gzip_types text/plain application/xml; //压缩的类型,
http://nginx.org/en/docs/http/ngx_http_gzip_module.html
6.nginx expires设置
设置一个缓存过时时间。
expires 1y;