NGINX
headers
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
env vars in config
https://docs.docker.com/samples/library/nginx/#using-environment-variables-in-nginx-configuration
- Create upstreams.conf.template. wrap vars with ${}
upstream jaasmanda { server ${JAAS_MANDA}; }
- process vars. will copy processed to /etc/nginx/snippets/upstreams.conf
export JAAS_MANDA=$(ip route | grep default | cut -d ' ' -f 3):8080 envsubst < /etc/nginx/conf.d/upstreams.conf.template > /etc/nginx/snippets/upstreams.conf && nginx -g 'daemon off;'
- include upstreams.conf in nginx.conf
include /etc/nginx/snippets/upstreams.conf;
microservices
https://www.nginx.com/blog/building-microservices-using-an-api-gateway/