How to proxy pass in Nginx when applications are run on different local machine with different local IP

时间:2019-01-18 18:25:17

标签: java tomcat nginx

I have 5 java applications which are on 5 different linux machine. Each machine contains different local IP. Application context path like ccl,efl,wac,fol & wac.

I want to proxy pass to these 5 machines from my another machine that contains Nginx web server. My requirement is when user hits on the browser like sol/efl or sol/ccl than each application should be called based on context path.

I have used root and index directives for application those are run on the Nginx machine but how do I define these both directives for applications which is run on different machine ??

server {
   listen       80;
   server_name  example.com;

   location /ccl {
     proxy_pass http://192.168.51.115:8080;
    }
   location /efl {
     proxy_pass http://192.168.51.116:8080;
    }
   location /wc {
     proxy_pass http://192.168.51.117:8080;
    }
 }

I don't know whether this is the write way I tried commands, I appreciate your solution and suggestion. Thanks in advance.

0 个答案:

没有答案