I using NGINX as a reverse proxy.
I have 3 environments (develop, QA, production)
Consider, The IP address for develop is 1.2.3.4, qa is 4.3.2.1 and production is 3.4.1.2
I have configure the nginx.conf file as below and its working perfectly fine in case of develop environment.
While building these docker-image I have explisitly mention on which configuraton the image should be build as below
cd conf/clustered-develop/;sudo docker build -t jcibts-swmdtr-dev.jci.com/nginx:1 --build-arg PORT=8765 --build-arg ENVIRONMENT=clustered-develop .
The requirement is docker-image should be build only 1's and then it will be push to Docker Trusted repository.
It will be promoted to other environment's docker trusted repository without building the image again.
MY question is what can I do to work these single conf for all the environment.
Like ip replaced by localhost or ip replaced by 127.0.0.1 (I have tried both but not working)
worker_processes 4;
events { worker_connections 1024; }
http {
sendfile on;
upstream consumer-portal {
server 1.2.3.4:9006;
}
upstream licenseportal {
server 1.2.3.4:9006;
}
server {
listen 8765;
location /consumer-portal/ {
proxy_pass http://consumer-portal/;
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;
proxy_set_header X-Forwarded-Host $server_name;
}
location /licenseportal/ {
proxy_pass http://licenseportal/;
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;
proxy_set_header X-Forwarded-Host $server_name;
}
}
}