Created
March 27, 2019 13:30
-
-
Save jovanialferez/0061c2171cddb3c7032d94b27efd4962 to your computer and use it in GitHub Desktop.
play-proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
reverseproxy: | |
build: . | |
ports: | |
- 80:80 | |
restart: always | |
nginx: | |
depends_on: | |
- reverseproxy | |
image: nginx:alpine | |
whoami: | |
depends_on: | |
- reverseproxy | |
image: containous/whoami |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM nginx:alpine | |
COPY nginx.conf /etc/nginx/nginx.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user nginx; | |
worker_processes 1; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include /etc/nginx/mime.types; | |
default_type application/octet-stream; | |
log_format main_timed '$remote_addr - $remote_user [$time_local] "$request" ' | |
'$status $body_bytes_sent "$http_referer" ' | |
'"$http_user_agent" "$http_x_forwarded_for"'; | |
access_log /dev/stdout main_timed; | |
error_log /dev/stderr info; | |
sendfile on; | |
#tcp_nopush on; | |
upstream docker-nginx { | |
server nginx:80; | |
} | |
upstream docker-whoami { | |
server whoami:80; | |
} | |
keepalive_timeout 65; | |
#gzip on; | |
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; | |
server { | |
listen 80; | |
server_name nginx.localhost; | |
location / { | |
proxy_pass http://docker-nginx; | |
proxy_redirect off; | |
} | |
} | |
server { | |
listen 80; | |
server_name whoami.localhost; | |
location / { | |
proxy_pass http://docker-whoami; | |
proxy_redirect off; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment