I use nginx to reverse proxy to multiple dockerized apps, which work. But I can't get portainer working.
My nginx config includes:
location ^~ /apps/portainer {
proxy_http_version 1.1;
proxy_set_header Connection "";
set $upstream portainer:9000;
proxy_pass http://$upstream;
}
The page does not load correctly (css and js don't load). The nginx error log:
[error] open() "/var/www/html/apps/main.11b0c8b84d24581.js" failed (2: No such file or directory), request: "GET /apps/main.11b0c8b84d24581.js HTTP/2.0"
I don't understand why nginx is trying to serve static files - everything should be proxied to portainer. (And the path is wrong, though irrelevant).
Is there a regular fix for this, that doesn't involve regex? BTW the answer given below by @EchoMike444 is excellent if you don't mind using regex in a location block.