add a nginx container as a reverse proxy
This commit is contained in:
parent
d0343b7dd8
commit
d7800ca0f7
|
@ -25,3 +25,12 @@ services:
|
||||||
- "DJANGO_SECRET_KEY=${DJANGO_SECRET_KEY}"
|
- "DJANGO_SECRET_KEY=${DJANGO_SECRET_KEY}"
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
|
|
||||||
|
nginx:
|
||||||
|
build: ./nginx
|
||||||
|
ports:
|
||||||
|
- 80:80
|
||||||
|
depends_on:
|
||||||
|
- web
|
||||||
|
volumes:
|
||||||
|
- ./network_inventory/static:/home/app/web/static
|
||||||
|
|
|
@ -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
|
|
@ -0,0 +1,19 @@
|
||||||
|
upstream network_inventory {
|
||||||
|
server web:8000;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
|
||||||
|
listen 80;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://network_inventory;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_redirect off;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /static/ {
|
||||||
|
alias /home/app/web/static/;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue