How to use vue.js with Nginx?

前端 未结 1 596
不知归路
不知归路 2021-02-07 03:44

I want to build a single page application with Vue.js using Nginx as my webserver and a my own Dropwiward REST API. Moreover I use Axios to call my REST request.

My n

相关标签:
1条回答
  • 2021-02-07 04:01

    Add the following code to your Nginx Config:

    location / {
      try_files $uri $uri/ /index.html;
    }
    

    the following snippet has been taken from vue-router docs, which is here.

    Also, you need to enable history mode on VueRouter:

    const router = new VueRouter({
      mode: 'history',
      routes: [...]
    })
    
    0 讨论(0)
提交回复
热议问题