I have 2 deployments on a kubernetes VPS. They are exposed via NodePort service.
I have nginx installed and I'm trying to reverse proxy requests to these deployments in a way that for example "server.com" goes to the first deployment and "server.com/suburl" goes to the second deployment. I've tried something similar to this from a website:
server {
listen ...;
...
location / {
proxy_pass http://127.0.0.1:8080;
}
location /blog {
proxy_pass http://127.0.0.1:8181;
}
location /mail {
proxy_pass http://127.0.0.1:8282;
}
...
}
It's not working.
When i open the / location it brings me to the main website page, but when I open any of the sub URLs it doesn't open anything and shows white page with no text. The url on top appears to redirect to / and if I refresh it will open the main website.
Any ideas on how to fix it or better way of doing it?