M
M
Mikhail2021-09-01 18:13:40
Nginx
Mikhail, 2021-09-01 18:13:40

How to run vue in serve mode on prod via nginx?

I run it on the production through the yarn dev console
The block itself is in package.json

"scripts": {
    "serve": "vue-cli-service serve --port 3000",
    "dev": "npm run serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },

App running at:
- Local: localhost:3000
- Network: unavailable

In nginx block:
location /mydir {
          proxy_pass http://localhost:3000;
          proxy_http_version 1.1;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection 'upgrade';
          proxy_set_header Host $host;
          proxy_cache_bypass $http_upgrade;
    }


I go to the site and get Invalid Host header or white page
In the console I see 404 on app.js

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail, 2021-09-01
@Sergo94Min

The reason was in publicPath

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question