Skip to content

Instantly share code, notes, and snippets.

@stampycode
Last active May 18, 2017 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stampycode/f11bc2b3799191d74513f0f213ffb20b to your computer and use it in GitHub Desktop.
Save stampycode/f11bc2b3799191d74513f0f213ffb20b to your computer and use it in GitHub Desktop.
NGinx multi-docker-container reverse proxy config
events {
worker_connections 1024;
}
http {
resolver 127.0.0.11;
server {
server_name ~^(?<ctrn>[^\.]+)-(qa|dev)\.;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
set $pp "http://$ctrn";
proxy_pass $pp;
}
}
server {
server_name ~^(?<ctrn>[^\.]+);
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
set $pp "http://$ctrn";
proxy_pass $pp;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment