JeecgBoot部署到服务器后加载速度较慢解决方案

JeecgBoot 官网推荐前端项目 nginx 部署的时候加上 gzip 压缩,加速第一次访问

具体参考网址:http://pro.ant.design/docs/deploy-cn#%E4%BD%BF%E7%94%A8-nginx

nginx 开始 gzip 压缩配置如下:

server {
    listen 80;
    # gzip config
    gzip on;
    gzip_min_length 1k;
    gzip_comp_level 9;
    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;
    gzip_disable "MSIE [1-6]\.";

    root /usr/share/nginx/html;

    location / {
        # 用于配合 browserHistory使用
        try_files $uri $uri/ /index.html;

        # 如果有资源,建议使用 https + http2,配合按需加载可以获得更好的体验
        # rewrite ^/(.*)$ https://preview.pro.ant.design/$1 permanent;

    }
    location /api {
        proxy_pass https://preview.pro.ant.design;
        proxy_set_header   X-Forwarded-Proto $scheme;
        proxy_set_header   Host              $http_host;
        proxy_set_header   X-Real-IP         $remote_addr;
    }
}

猜你喜欢

转载自blog.csdn.net/qq_43647359/article/details/107770506