nginx 配置项优化

排查是否存在以下配置项。

网络协议

更换 http1.1 为 http2,需配置 https。

server {
  listen       3115 ssl http2;
  server_name  oa.com;
}

缓存配置

location /oa/web {
    alias  E:/nginx-1.20.2/front/zjs_fgw_oa_vue/;
    index  index.html index.htm;
    try_files $uri $uri/  /oa/web/index.html;
    # 只禁用入口页面缓存
    if ($request_filename ~* .*\.(?:htm|html)$) {
        add_header Cache-Control 'private, no-store, max-age=0';
    }
}

GZIP配置

     gzip on;   
    gzip_buffers 8 16k;
    gzip_comp_level 2;
    gzip_disable "MSIE [1-6]\.(?!.*SV 1)";
    gzip_min_length 1k;
    # gzip_http_version 1.0;
    gzip_proxied expired no-cache no-store private auth;
    gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
    gzip_vary on;
posted @ 2023-05-09 09:08  混名汪小星  阅读(27)  评论(0)    收藏  举报