1.2017年連續爆出5.x版本xshell安全問題和intel的cpu設計漏洞 ,此時我就注意到盡量少暴露自己線上使用的工具以及版本。例如:mysql版本,以及緩存層策略,服務器版本等,以下為 隱藏 nginx的版本號方法:
nginx配置中:
http段中,加入配置
server_token off;
或者修改源碼中,字符串定義。編輯src/core/nginx.h,
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;