I am trying nginx for the first time and I am running it locally. I have been able to get my services up but I have a puzzling question because I run a Microservice and during upgrade I want to be able to just block a particular service.
Now, each service has a a path eg
\api\v1\wallet
\api\v1\card
the issue I have is that both wallet and card path are in the same service.
If I have different paths would I have to duplicate or there's a way I could make it work better?
Here is my conf file
worker_processes 4;
events { worker_connections 1024; }
http {
server {
listen 80;
charset utf-8;
location ~ ^/api/v1/user {
rewrite ^/api/v1/user/(.*) /$1 break;
proxy_pass http://user-service:3001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'Upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /api/v1/wallet/ {
# rewrite /api/v1/wallet/(.*) /$1 break;
proxy_pass http://wallet-service:3007/api/v1/wallet/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'Upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /api/v1/card/ {
# rewrite /api/v1/wallet/(.*) /$1 break;
proxy_pass http://wallet-service:3007/api/v1/card/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'Upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
}