Skip to content

Commit

Permalink
#49 nginx in front of gunicorn to serve static files
Browse files Browse the repository at this point in the history
  • Loading branch information
Sh4kE committed Nov 15, 2016
1 parent 35605f8 commit a3c12b3
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 4 deletions.
31 changes: 27 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,42 @@
ofmhelper:
web:
build: .
volumes:
- .:/usr/src/app
- /usr/src/app
- /usr/src/app/staticfiles
links:
# - postgres
# - memcached
- phantomjs
ports:
- "8000:8000"

nginx:
restart: always
build: ./nginx/
ports:
- "80:80"
volumes:
- /www/static
volumes_from:
- web
links:
- web:web

#postgres:
# restart: always
# image: postgres
# ports:
# - "5432:5432"
# volumes:
# - pgdata:/var/lib/postgresql/data/

#memcached:
# image: atbaker/memcached-verbose
#redis:
# restart: always
# image: redis
# ports:
# - "6379:6379"
# volumes:
# - redisdata:/data

phantomjs:
image: wernight/phantomjs
Expand Down
3 changes: 3 additions & 0 deletions nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM tutum/nginx
RUN rm /etc/nginx/sites-enabled/default
ADD sites-enabled/ /etc/nginx/sites-enabled
18 changes: 18 additions & 0 deletions nginx/sites-enabled/django_project
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
server {

listen 80;
server_name ofm_helper;
charset utf-8;

location /static {
alias /usr/src/app/staticfiles;
}

location / {
proxy_pass http://web:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

}

0 comments on commit a3c12b3

Please sign in to comment.