How to deploy vue project for nginx on linux ubuntu CVM

the proxy is used in the vue project. After build, the server on the configuration reported a 404 error, which should be caused by not being able to use the proxy of dev server. Configure how to use nginx, on the server to configure nginx to implement the proxy

configured nginx.conf and another configuration file sites-available/default,. If you follow the path where I put the project, you can see that nginx uses the default configuration file? I don"t know why?

related code:

Cross-domain requests used in vue projects:

async getSomeDetail() {
    await axios.get("/api/someDetail.json").then(res => {
    his.someDetail = res.data
    })
}

dev server Agent:

"/api":{
    target:"http://localhost:8080",
    pathRewrite:{"^/api":"/static/mock"}
}

production environment deployment do not do this. Build, should be compiled into a pure static website project with vue-cli, and then deployed directly in nginx

.
Menu