Skip to content

Instantly share code, notes, and snippets.

@gervasiocaj
Created September 27, 2016 22:26
Show Gist options
  • Save gervasiocaj/af88066c1b4d6937e58eef210a888559 to your computer and use it in GitHub Desktop.
Save gervasiocaj/af88066c1b4d6937e58eef210a888559 to your computer and use it in GitHub Desktop.
Simple nginx reverse proxy with example Python and Node server
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
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