如果一个nuxt项目只开发一个子目录,这种配置就行https://blog.csdn.net/hoyche/article/details/113866249
如果一个nuxt项目要开发多个子目录,那么router就不能指定了,只能是默认的根目录,并且需要给Nginx多配置一条静态资源规则
{
location ~ ^/_nuxt {
proxy_pass http://localhost:3000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
}
}
如果要修改默认的_nuxt目录,可以给build配置publicPath: '/fe'
build: {
publicPath: 'https://cdn.nuxtjs.org'
}
// 将.nuxt/dist/client目录的内容上传到您的 CDN 即可!
注意:Nginx反向代理cookie丢失的问题,给代理规则加上
proxy_cookie_path /nuxt项目目录;