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
})
]
}