EDIT: I'm serving my node backend with proxy_pass like:

 location / {
   allow all;

 location /backend {
      proxy_pass http://localhost:60702;
      # Some headers

When removing this file it works as I want. Why is this part causing all the errors?

Well, now I got just another problem with some redirects in Vue/nginx.

Now I am hosting vue with nginx and set the root directory to /var/www/client/pvapp-client/dist. When typing in some path to the URL like "https://url.de/pathname" I get errors equivalent to:

*2 open() "/var/www/client/pvapp-client/dist/app" failed (2: No such file or directory)

Why is it checking for a directory in dist like that? It should stay on the same page or redirect to the paths specified in vue like router.push('/home')

Nginx conf location block is:

location / {
   # point to dist folder inside vue source code folder
   root /var/www/client/pvapp-client/dist;
   autoindex on;
   autoindex_exact_size off;
   index index.html index.htm;
   try_files $uri $uri/ /index.html;

All right, for future people looking for this here's the solution.

To the Nginx node config (your backend) add:

error_page 404 =200 /index.html;

Before the location block. That redirects all paths that are not found to the current page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.