I have a java app which has login section for all users (http://192.168.0.101:8080/login) and admin section for admins(http://192.168.0.101:8080/admin).
I want to run this app in two servers for different users.
http://192.168.0.101:8080/ >> Normal Users + Admins
http://192.168.0.102:8080/admin >> Admins Only
I am trying this with nginx.
server {
listen 80;
server_name domain.com;
location / {
proxy_pass http://192.168.0.101:8080/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /admin/ {
proxy_pass http://192.168.0.102:8080/admin/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
My nginx is in http://192.168.0.103/ Now, if i access http://192.168.0.103/, it shows me data from http://192.168.0.101:8080/. which is ok. But if i try http://192.168.0.103/admin then it takes me to http://192.168.0.101:8080/login as login page is for all users(including admins).
What can i do about it ?
By the all i am trying to do is to reduce load on the server. It eat a lot of CPU with 60-65 users(not admins) at a time ... :(
Admin section has a lot of tasks which leave impact on server.
So, i was planning to run application in two different server with same DB and balance the load. Any Suggestion ?