I have two different app servers one is my custom application and other is CRM. My custom app will get request and it will request crm server for some data and at the end server the customer. I have one nginx which is handling the crm and I want the same nginx deal with my application and let those app communicate in between.
I have tried with the following config
upstream example.net{
server 192.168.200.144:8080; # virtual machine web1 site
server 192.168.200.143:8080; # virtual machine web2 site
}
upstream example-crm.net{
server 192.168.200.85:8080; # virtual machine web1 site
server 192.168.200.86:8080; # virtual machine web2 site
}
server {
listen 192.168.200.173; # public IP address of your server
server_name example.net;
server_name example-crm.net
location / {
proxy_pass http://example.net;
proxy_pass http://example-crm.net;
proxy_connect_timeout 900;
proxy_send_timeout 900;
proxy_read_timeout 900;
send_timeout 900;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
but it doesn't work.
to make it more clear i have drawn a diagram which explain the scenario
Diagram Explanation:
customer send request 1 on virtual IP 192.168.200.173, nginx send request 2 to app 1 server, app 1 server sends request 3 to nginx for app 2 server, nginx send request 4 to app 2 server, and app 2 send request 5 to nginx and nginx send request 6 to app 1 and app 1 performs its business logic and send request 7 to nginx and nginx serve the request 8 to the customer.
Any suggestion ?