0

I have two instances of the same VueJS app in two different servers. I'm trying to use upstream form nginx for load balancing but it is returning 404 on all files under static.

I've tried to keep this as simple as I could, this are the Nginx config files:

Proxy:

upstream frontend {
    server 10.16.19.173;
    server 10.16.19.166;
}

server {
    location / {
#       try_files $uri $uri/ /index.html;
        proxy_set_header Host $host;
        proxy_pass http://frontend;

    }

}

The config on the servers that host the app:

server {

    listen 80;
    root   /usr/share/nginx/html/portal-web/dist/cms;

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

   error_page 404 /404.html;
        location = /40x.html {
   }

   error_page 500 502 503 504 /50x.html;
        location = /50x.html {
   }

}

static files are under /usr/share/nginx/html/portal-web/dist/cms/static.

I've tried all the rewrite sugestions I've found but don't seem to get this working. I'm not using Docker and can't use it.

Thanks

  • I miss on both the server_name directive, as an example from a [another post I answered](https://serverfault.com/questions/1097219/make-nginx-redirect-to-https-even-with-competing-location-regex/1097496#1097496) I think you might overseeing that – djdomi Apr 12 '22 at 17:08

0 Answers0