Last active
November 12, 2017 14:22
-
-
Save stepankuzmin/5f3e3431c5e47bc0ae3d9c429aebf49f to your computer and use it in GitHub Desktop.
Example project with Nginx + Redis
This file contains hidden or 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: | |
| 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 |
This file contains hidden or 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 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