Score:0

Nginx returning 404 on all static files when using upstream and reverse proxy with VueJS apps

tr flag

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

djdomi avatar
za flag
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
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.