已验证解决We’re sorry but XXX doesn’t work properly without JavaScript enabled
vue3 项目. history模式先要明白一个概念,本地能调通是因为你在本地vue.config.js中或package.json的vue中配置了代理转发,那么你部署到线上的话,vue项目被打包后,这些配置在服务器上是不生效的,此时你需要在nginx上配置代理转发,才能解决这个问题.vue请求格式axios.get('/api/v1/version/read')nginx配置location /
·
vue3 项目. history模式
先要明白一个概念,本地能调通是因为你在本地vue.config.js中或package.json的vue中配置了代理转发,那么你部署到线上的话,vue项目被打包后,这些配置在服务器上是不生效的,此时你需要在nginx上配置代理转发,才能解决这个问题.
vue请求格式
axios.get('/api/v1/version/read')
nginx配置
location / {
root /usr/share/nginx/html/dist; # 存放dist
index index.html index.htm;
try_files $uri $uri/ /index.html; # 解决页面刷新
}
# 配置与后端服务器地址的映射
location ^~ /api/ {
proxy_pass http://172.17.0.2:8080/api/;
}
更多推荐
所有评论(0)