How to create same location to point different proxy server

abdul kadhar kadhar2006 at gmail.com
Mon May 22 07:13:18 UTC 2023


Hi,

I need to know how to configure nginx for below scenario.

I have configured the Load Balancer(Nginx) for ignition. I have created two
upstream(ignapp & ignProdapp) server. For ignapp upstream it is working
fine. I need to configure the below code for upstream server(ignProdapp) in
the same configuration file how to do this. Below is the sample
configuration for the server ignapp. Can you please help me how to
configure the below settings for another upstream server. Below is the
config setting for ignapp same way I need to do it for creating location ~
/data/, location ~ /system/ , location ~ /res/ , location ~ /idp/, location
~ /.well-known/ for ignappPro Upstream server .



Upstream ignapp{
ip_hash;
server 10.10.10.11:8088;
}
upstream ignappPro {
ip_hash;
server 10.10.10.12:8088;
}
server {
listen 80;
server_name www.abdul.com;
location ~ /data/ {

proxy_pass ignapp/data/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_pass_request_headers on;
proxy_cache_bypass $http_upgrade;
}

location ~ /system/ {

proxy_pass ​ignapp/system/;
tp_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_pass_request_headers on;
proxy_cache_bypass $http_upgrade;
}

location ~ /res/ {

proxy_pass ignapp/res/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_pass_request_headers on;
proxy_cache_bypass $http_upgrade;
}

location ~ /idp/ {

proxy_pass ​ignapp/idp/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_pass_request_headers on;
proxy_cache_bypass $http_upgrade;
}

location ~ /.well-known/ {

proxy_pass ignapp/.well-known/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_pass_request_headers on;
proxy_cache_bypass $http_upgrade;
}

# Here we are setting the protocol type, address, port, and uri (optional)
that will be the destination of our proxied server:
location / {
proxy_pass ​ignapp/data/perspective/client/demo/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_pass_request_headers on;
proxy_cache_bypass $http_upgrade;
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20230522/eb9546ea/attachment.htm>


More information about the nginx-devel mailing list