I am new to nginx, I am using it for request forwarding purpose, each incoming request is getting forwarded to another server/url below is my configuration :
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 8008 ssl;
listen localhost:8008 ssl;
listen xyz.exmaple.com:8008 ssl;
server_name xyz.exmaple.com;
more_set_headers 'Server: ABC';
ssl_protocols TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers "EECDH+AESGCM,EDH+AESGCM";
ssl_certificate /logs/ssl/SSL.crt;
ssl_certificate_key /logs/ssl/key.key;
location /app/ {
proxy_pass https://proxy1.example.com:8888/abc/efg;
proxy_read_timeout 60s;
# May not need or want to set Host. Should default to the above hostname.
proxy_pass_header Server;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
add_header X-Frame-Options "SAMEORIGIN" always;
more_set_headers 'Server: ABC';
}
}
}
Every request on https://xyz.exmaple.com:8008/app/ is getting forwarded to https://proxy1.example.com:8888/abc/efg
Now I have two urls :
1) https://proxy1.example.com:8888/abc/efg
2) https://proxy2.example.com:8888/abc/efg
I want round robin load balancing for this two URL, How can i achieve that ?