nginx+iview-admin 404

iview-admin
mode:history 
刷新页面404错误
解决办法:nginx配置

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;

    
    gzip on;
	gzip_static on;    
	gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
	gzip_proxied  any;
	gzip_vary on;
	gzip_comp_level 6;
	gzip_buffers 16 8k;
	gzip_http_version 1.1;


	server {
        listen       8085;
        server_name  xxxxx; 
        location / {
            proxy_pass   http://master:30022/;
		}
	}
    server {
		set $web_path E:\workspace\vue_work\my-server-ui\dist;
	    
        listen       8087;
        server_name  localhost; 
		root  $web_path;
		
		location ~ .*\.(js|css)$ {
		    root   $web_path;
	    }
        location / {
		      try_files $uri $uri/ @router;
              index index.html;
        }
		location @router {
			rewrite ^.*$ /index.html last;
		}
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }

}

view-admin  使用gzip压缩js、csss

step1

   npm install --save-dev compression-webpack-plugin
  (npm view compression-webpack-plugin version  == 4.0.0)

step2

编辑vue.confg.js文件
const CompressionPlugin = require("compression-webpack-plugin");

在module.exports = {}增加

configureWebpack: {
    plugins: [
    new CompressionPlugin({
        filename: '[path].gz[query]',
        algorithm: 'gzip',
        test: /\.js$|\.css$/,
        threshold: 10240,
        minRatio: 0.8,
        deleteOriginalAssets: true
      })
    ]
  }

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值