Skip to content

Instantly share code, notes, and snippets.

@stepankuzmin
Last active November 12, 2017 14:22
Show Gist options
  • Save stepankuzmin/5f3e3431c5e47bc0ae3d9c429aebf49f to your computer and use it in GitHub Desktop.
Save stepankuzmin/5f3e3431c5e47bc0ae3d9c429aebf49f to your computer and use it in GitHub Desktop.
Example project with Nginx + Redis
version: '3'
services:
nginx:
image: stepankuzmin/nginx-with-redis
ports:
- 8080:80
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
falcon:
build: .
ports:
- 3000:3000
environment:
- DATABASE_URL=postgres://postgres@db:5432/postgres
db:
image: mdillon/postgis:10-alpine
ports:
- 5432:5432
volumes:
- ./db:/var/lib/postgresql/data
redis:
image: redis:alpine
server {
listen 80 default_server;
server_name localhost;
resolver 127.0.0.11;
root /usr/share/nginx/html;
location / {
set $redis_key $uri;
redis_pass redis:6379;
default_type text/html;
error_page 404 = /falcon$uri;
}
location ~ /falcon/(?<fwd_path>.*) {
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_redirect off;
proxy_pass http://falcon:3000/$fwd_path$is_args$args;
}
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