多语言展示
当前在线:506今日阅读:23今日分享:25

nginx 简单优化部分

nginx文件优化
工具/原料

lnmp

方法/步骤
1

nginx文件压缩文档:http://nginx.org/en/docs/http/ngx_http_gzip_module.htmlgizp on/off  是否开启;gzip_buffer 32 4K| 16 8K  缓冲(压缩在内存中缓冲几块,每块多大)gzip_comp_level[1-9] 压缩级别(1-9)级别越高CPU压力越大推荐6gzip_disable  正则匹配,什么样的不进行压缩gzip_min_length 开始压缩的最小长度(再小就不用压缩)gzip_http_version 1.0|1.1 开始压缩http协议gzip_proxied 设置代理服务器是否缓存gzip_type text/plain application/xml  对那些类型进行压缩(mime_type文件中可以找到)gzip_vary on/of 是否开启gzip压缩标志图片不建议压缩

2

nginx缓存设置提高网站性能expires设置  http://nginx.org/en/docs/http/ngx_http_core_module.htmlif段或者location30m;2h;2d;location = /images/default.gif {      expires 30s; }

推荐信息