#2: use gunicorn with nginx as reverse proxy
This commit is contained in:
parent
754363a92e
commit
3c1fec3f63
5 changed files with 32 additions and 10 deletions
4
.deployment/nginx/Dockerfile
Normal file
4
.deployment/nginx/Dockerfile
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
FROM nginx:1.17.4-alpine
|
||||
|
||||
RUN rm /etc/nginx/conf.d/default.conf
|
||||
COPY nginx.conf /etc/nginx/conf.d
|
||||
14
.deployment/nginx/nginx.conf
Normal file
14
.deployment/nginx/nginx.conf
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
upstream app_django {
|
||||
server django:8000;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
location / {
|
||||
proxy_pass http://app_django;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $host;
|
||||
proxy_redirect off;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,18 @@
|
|||
version: "3"
|
||||
|
||||
services:
|
||||
django-server:
|
||||
django:
|
||||
build: ../../
|
||||
ports:
|
||||
- "8042:8042"
|
||||
expose:
|
||||
- 8000
|
||||
volumes:
|
||||
- /run/mysqld/:/run/mysqld/
|
||||
env_file:
|
||||
- production.secrets.env
|
||||
|
||||
nginx:
|
||||
build: ../nginx
|
||||
ports:
|
||||
- 8042:80
|
||||
depends_on:
|
||||
- django
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue