Hkm Sadek
Hkm Sadek

Reputation: 3209

Nuxt js pages shows 404 not found

I have a nodejs project created with adonuxt. I have ssl enabled in my site.

I am using nginx reverse proxy that take requests to localhost:port in my server.

There two problems.

It always shows 404 in all js file. See the image please. enter image description here

It also doesn't load any images.

Another problem is, I can only see some out put for the home page, but if I visit to site.com/page it shows 404 not found (nginx/1.10.3 (Ubuntu))

Any idea whats wrong? Thank you so much for your time.

Upvotes: 2

Views: 7239

Answers (1)

Kacper Tylenda
Kacper Tylenda

Reputation: 51

It is caused by default Webpack settings - to change that edit your nuxt.config.js file to:

export modules = {
  buildDir: '_nuxt',
  build: {
    publicPath: '_nuxt/dist/'
  }
}

If you get 404 on routes check your nginx setup and make it similiar to the from the docs.

Default nginx settings does not allow vue-router to take care of routes.

Hope I helped.

Upvotes: 5

Related Questions