猿问

使用nginx部署vue项目一直报错

使用nginx部署vue项目一直报错,这个折腾我好几天了,哪位大神知道是什么原因吗?下面是我的nginx配置:
server{
indexindex.htmlindex.htm;
server_name***;
root/home/u/depolyfile/deploy;
listen80;
location/{
try_files$uri$uri/@rewrites;
}
location@rewrites{
rewrite^(.+)$/index.htmllast;
}
location~*\.(?:ico|css|js|gif|jpe?g|png)${
expiresmax;
add_headerPragmapublic;
add_headerCache-Control"public,must-revalidate,proxy-revalidate";
}
}
vue的router部分:
importVuefrom'vue'
importRouterfrom'vue-router'
importHelloWorldfrom'@/components/HelloWorld'
importDefaultPagefrom'@/components/DefaultPage'
Vue.use(Router)
exportdefaultnewRouter({
mode:'history',
routes:[
{
path:'/',
name:'HelloWorld',
component:HelloWorld
},
{
path:'*',
name:'DefaultPage',
component:DefaultPage
}
]
})
nginx错误信息:
2018/07/0214:26:01[error]5#5:*25rewriteorinternalredirectioncyclewhileredirecttonamedlocation"@rewrites"
RISEBY
浏览 3973回答 2
2回答

慕侠2389804

location@rewrites{rewrite^(.+)$/index.htmllast;}这一段不需要吧
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答