Missing well-known files
[wolnelektury.git] / scripts / nginx / nginx.conf
1 server {
2     listen 80;
3
4     access_log off;
5     error_log /dev/stderr warn;
6
7     client_max_body_size 4G;
8     send_timeout 300s;
9     proxy_buffers 16 16k;
10     proxy_buffer_size 32k;
11
12     root /app/var;
13
14     location /.well-known/ {}
15
16     location /static/ {
17         expires 30d;
18     }
19
20     location /media/ {
21         expires 30d;
22     }
23     location ~ ^/media/.*\.(mp3|ogg|daisy\.zip)$ {
24         add_header Content-Disposition "attachment";
25     }
26     location ~ ^/media/.*\.txt$ {
27         charset utf-8;
28     }
29     location ~ ^/media/book/(pdf|epub|mobi|fb2|cover|xml)/ {
30         # kill cache
31         add_header Last-Modified $date_gmt;
32         add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
33         if_modified_since off;
34         expires off;
35         etag off;
36     }
37
38     location /api/ {
39         add_header 'Access-Control-Allow-Origin' '*' always;
40         add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE' always;
41         add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type' always;
42         add_header 'Access-Control-Expose-Headers' 'Link' always;
43
44         if ($request_method = OPTIONS) {
45             return 204;
46         }
47
48         proxy_set_header Accept-Language "";
49         proxy_set_header Host $host;
50         proxy_pass http://web:8000;
51     }
52     location / {
53         root /app/var/static/root;
54         try_files $uri @backend;
55     }
56
57     location @backend {
58         proxy_set_header Accept-Language "";
59         proxy_set_header Host $host;
60         proxy_pass http://web:8000;
61     }
62 }