server { listen 80; access_log off; error_log /dev/stderr warn; client_max_body_size 4G; send_timeout 300s; proxy_buffers 16 16k; proxy_buffer_size 32k; location /static/ { root /app/var; expires 30d; } location /media/ { root /app/var; expires 30d; } location ~ ^/media/.*\.(mp3|ogg|daisy\.zip)$ { add_header Content-Disposition "attachment"; } location ~ ^/media/.*\.txt$ { add_header Content-Type "text/plain; charset=utf-8"; } location ~ ^/media/book/(pdf|epub|mobi|fb2|cover|xml)/ { # kill cache add_header Last-Modified $date_gmt; add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; if_modified_since off; expires off; etag off; } location /api/ { add_header 'Access-Control-Allow-Origin' '*' always; add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE' always; add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type' always; add_header 'Access-Control-Expose-Headers' 'Link' always; if ($request_method = OPTIONS) { return 204; } proxy_set_header Accept-Language ""; proxy_set_header Host $host; proxy_pass http://web:8000; } location / { root /app/var/static/root; try_files $uri @backend; } location @backend { proxy_set_header Accept-Language ""; proxy_set_header Host $host; proxy_pass http://web:8000; } }