static files
This commit is contained in:
@@ -1,8 +1,22 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
nginx:
|
||||
image: nginx:1.16-alpine
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./docker/conf/nginx:/etc/nginx/conf.d
|
||||
- ./docker/static_collected:/app/static_collected
|
||||
- ${MEDIA_DIR}:/app/data/media
|
||||
ports:
|
||||
- ${HTTP_PORT}:80
|
||||
#command: "/bin/sh -c 'while :; do sleep 1m & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
|
||||
depends_on:
|
||||
- web
|
||||
networks:
|
||||
- nginx_network
|
||||
web:
|
||||
restart: always
|
||||
restart: unless-stopped
|
||||
build: "."
|
||||
links:
|
||||
- "db:postgres"
|
||||
@@ -13,13 +27,12 @@ services:
|
||||
- ${MEDIA_DIR}:/app/data/media
|
||||
networks:
|
||||
- db_network
|
||||
- nginx_network
|
||||
command: "/bin/sh -c '/app/wait-for-postgres.sh postgres /app/run.sh'"
|
||||
ports:
|
||||
- ${HTTP_PORT}:80
|
||||
env_file:
|
||||
- ./.env
|
||||
db:
|
||||
restart: always
|
||||
restart: unless-stopped
|
||||
image: postgres:9.6-alpine
|
||||
env_file:
|
||||
- ./.env-db
|
||||
@@ -29,5 +42,8 @@ services:
|
||||
- db_network
|
||||
|
||||
networks:
|
||||
nginx_network:
|
||||
driver: bridge
|
||||
db_network:
|
||||
driver: bridge
|
||||
|
||||
|
||||
41
docker/conf/nginx/app.conf
Normal file
41
docker/conf/nginx/app.conf
Normal file
@@ -0,0 +1,41 @@
|
||||
upstream gunicorn {
|
||||
server web:80;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name tagesschule.mprofiag.ch;
|
||||
server_tokens off;
|
||||
sendfile on;
|
||||
|
||||
add_header X-Frame-Options "";
|
||||
|
||||
gzip on;
|
||||
gzip_http_version 1.1;
|
||||
gzip_disable "MSIE [1-6]\.";
|
||||
gzip_min_length 256;
|
||||
gzip_vary on;
|
||||
gzip_proxied expired no-cache no-store private auth;
|
||||
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
|
||||
gzip_comp_level 9;
|
||||
|
||||
location /static/ {
|
||||
sendfile on;
|
||||
alias /app/static_collected/;
|
||||
}
|
||||
|
||||
location /media/ {
|
||||
sendfile on;
|
||||
alias /app/data/media/;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_hide_header X-Frame-Options;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header Host $host;
|
||||
proxy_redirect off;
|
||||
proxy_pass http://gunicorn;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user