Skip to content

Instantly share code, notes, and snippets.

@stampycode
Last active May 18, 2017 14:35
Show Gist options
  • 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