Nginx 配置
server {listen 8230;server_name 8230;charset utf-8;gzip on;gzip_buffers 32 4K;gzip_comp_level 6;gzip_min_length 1k;gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;gzip_disable "MSIE [1-6]\.";gzip_http_version 1.1;gzip_vary on;location / {root /root/qianduan/dist;try_files $uri $uri/ /index.html;index index.html index.htm;add_header Access-Control-Allow-Origin *;}}
安装插件
npm install vite-plugin-compression
vite.config.js