【发布时间】:2019-12-09 12:35:08
【问题描述】:
我按照 vue 教程部署上下文路径为 https://cli.vuejs.org/config/#publicpath 的应用程序 我使用了 vue 提供的 caddy 规则,因为我使用的是历史模式https://router.vuejs.org/guide/essentials/history-mode.html#caddy
我正在使用 caddy 进行部署。
但是当我使用公共路径时,我选择具有 /path 的路由器配置,它给我 404。它在本地工作正常;但在球童上不起作用。
Vue.use(Router)
const routes = [
{ path: '/', component: Home },
{ path: '/markabsent/:studentid/:techerid', component: StudentForm, props: true },
{ path: '/markpresent/:studentid/teacher/:techerid', component: StudentReturnForm},
{ path: '*', component: PageNotFound }
]
export default new Router({
mode: 'history',
base: 'univ',
routes
})
我只使用下面的默认球童配置
0.0.0.0:2015
root /var/www/html
log stdout
errors stdout
rewrite {
regexp .*
to {path} /
}
当我访问 myapp.com/univ/markpresent/43/343 时。 ,它的 404。当我访问 ,myapp.com/univ/ 时,它会加载初始页面
【问题讨论】: