@@ -0,0 +1,49 @@ +worker_processes 4; + +events { + worker_connections 1024; + use epoll; + multi_accept on; +} + +http { + include mime.types; + default_type application/octet-stream; + client_max_body_size 25m; + + http2 on; + + access_log off; + error_log off; + + keepalive_timeout 30; + keepalive_requests 1000; + + sendfile on; + sendfile_max_chunk 1460; + tcp_nopush on; + tcp_nodelay on; + aio on; + aio_write on; + directio 1m; + output_buffers 1 1m; + + gzip on; + gzip_static on; + gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; + gzip_proxied any; + gzip_vary on; + gzip_comp_level 5; + gzip_buffers 16 8k; + gzip_http_version 1.1; + + server { + listen 80 default_server; + + location /static { + autoindex on; + expires 365d; + alias /var/www/static/; + } + } +} @@ -38,6 +38,8 @@ services: - traefik.http.routers.backend.tls.certresolver=defaultresolver - traefik.http.routers.backend.service=backend - traefik.http.services.backend.loadbalancer.server.port=8000 + - traefik.http.middlewares.backend.redirectscheme.scheme=https + - traefik.http.middlewares.test-backend.redirectscheme.permanent=true env_file: - $ENV depends_on: @@ -106,6 +108,19 @@ services: placement: constraints: - node.role == worker + labels: + - traefik.enable=true + - traefik.docker.network=infrastructure + - traefik.http.routers.backend-static.rule=Host(`backend.air.fail`) && PathPrefix(`/static`) + - traefik.http.routers.backend-static.entrypoints=web,websecure + - traefik.http.routers.backend-static.tls=true + - traefik.http.routers.backend-static.tls.certresolver=defaultresolver + - traefik.http.routers.backend-static.service=backend-static + - traefik.http.services.backend-static.loadbalancer.server.port=80 + - traefik.http.middlewares.backend-static.redirectscheme.scheme=https + - traefik.http.middlewares.test-backend-static.redirectscheme.permanent=true + networks: + - infrastructure volumes: - static:/var/www/static env_file: