Created
September 27, 2016 22:26
-
-
Save gervasiocaj/af88066c1b4d6937e58eef210a888559 to your computer and use it in GitHub Desktop.
Simple nginx reverse proxy with example Python and Node server
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: '2' | |
services: | |
python1: | |
image: python:2.7 | |
ports: | |
- "8000:8000" | |
command: python -m SimpleHTTPServer | |
node1: | |
image: node | |
ports: | |
- "8080:8080" | |
command: /bin/bash -c "npm i -g http-server && http-server" | |
nginx: | |
image: nginx | |
volumes: | |
- ./my.conf:/etc/nginx/conf.d/default.conf | |
ports: | |
- "80:80" | |
command: /bin/bash -c "nginx -g 'daemon off;'" | |
depends_on: | |
- python1 | |
- node1 |
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
server { | |
listen 80; | |
location /teste1/ { | |
proxy_pass http://python1:8000/; | |
} | |
location /teste2/ { | |
proxy_pass http://node1:8080/; | |
} | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
root /usr/share/nginx/html; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment