How to use nginx as LoadBalancer for different VMs

Viewed 14

I have 2 different VMs running the same application, vvallet.com on Kubernetes (192.168.86.147 and 192.168.86.149). I also have a VM with nginx serving as LoadBalancer, however when I access the IP of this VM it doesn't forward to the application, only to the default nginx page.

My default.conf file looks like this:

upstream vvallet {
    server 192.168.86.149;
    server 192.168.86.147;
}

server {
    listen 80;
    server_name  www.vvallet.com vvallet.com;

    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Real-IP  $remote_addr;

    location / {
        proxy_pass http://vvallet;
    }

}

Am I missing anything?

0 Answers
Related