Skip to content

Instantly share code, notes, and snippets.

@mrwithersea
Created November 15, 2017 14:06
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 mrwithersea/41872824c6f7b6c2d15ba829ddd75dae to your computer and use it in GitHub Desktop.
Save mrwithersea/41872824c6f7b6c2d15ba829ddd75dae to your computer and use it in GitHub Desktop.
Web proxy poc
version: '2'
services:
service-one:
image: nginx:1.9
volumes:
- ./service1:/usr/share/nginx/html/
ports:
- "3001:80"
service-two:
image: nginx:1.9
volumes:
- ./service2:/usr/share/nginx/html/
ports:
- "3002:80"
web-proxy:
image: nginx:1.11.5-alpine
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- "8080:80"
links:
- service-one
- service-two
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location /service-one {
proxy_pass http://service-one/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /service-two {
proxy_pass http://service-two/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
include servers/*;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment