999d40d6a8de282b7473b9ee8401772d20debde2
[lhc/ateliers.git] / etc / nginx / site.d / davical / site.conf
1 server_name
2 davical.heureux-cyclage.org
3 davical.autogeree.net
4 davical.cyclocoop.org;
5
6 client_body_buffer_size 8k;
7 client_max_body_size 10m;
8
9 rewrite ^\.well-known(.*)$ /caldav.php/.well-known$1;
10 rewrite ^principals/users(.*)$ /caldav.php$1;
11
12 location / {
13 # NOTE: to get DAViCal and nginx working with iCal 6.0 clients.
14 return 301 /caldav.php$1;
15 }
16 location ~* ^.+.(css|gif|html|ico|jpeg|js|jpg|png|txt|xml)$ {
17 root /usr/share/davical/htdocs/;
18 access_log off;
19 expires 30d;
20 log_not_found off;
21 }
22 location ~ /\. {
23 access_log off;
24 deny all;
25 log_not_found off;
26 }
27 location ~ \.php(|/.*)$ {
28 root /usr/share/davical/htdocs/;
29 keepalive_timeout 10;
30 include /etc/nginx/conf.d/fastcgi.conf;
31 #if ($request_method = OPTIONS) {
32 # add_header Access-Control-Allow-Credentials "true";
33 # add_header Access-Control-Allow-Headers "User-Agent,Authorization,Content-type,Depth,If-match,If-None-Match,Lock-Token,Timeout,Destination,Overwrite,X-client,X-Requested-With";
34 # add_header Access-Control-Allow-Methods "GET,POST,OPTIONS,PROPFIND,REPORT,PUT,MOVE,DELETE,LOCK,UNLOCK";
35 # add_header Access-Control-Allow-Origin "*";
36 # add_header Content-Length 0;
37 # add_header Content-Type text/plain;
38 # return 200;
39 # }
40 set $no_cache "0";
41 if ($request_method !~ ^(GET|HEAD)$) {
42 # NOTE: if non GET/HEAD, don't cache and mark user as uncacheable for 1 second via cookie.
43 set $no_cache "1";
44 }
45 if ($no_cache = "1") {
46 # NOTE: drop no cache cookie if need be (for some reason, add_header fails if included in prior if-block).
47 add_header Set-Cookie "_mcnc=1; Max-Age=2; Path=/";
48 add_header X-Microcachable "0";
49 }
50 if ($http_cookie ~* "_mcnc") {
51 # NOTE: bypass cache if no-cache cookie is set
52 set $no_cache "1";
53 }
54 fastcgi_cache_bypass $no_cache;
55 fastcgi_cache_use_stale updating;
56 fastcgi_cache_valid 200 10s;
57 fastcgi_cache_valid 404 10m;
58 fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
59 fastcgi_index index.php;
60 fastcgi_param PATH_INFO $fastcgi_path_info;
61 fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
62 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
63 fastcgi_no_cache $no_cache;
64 fastcgi_param REDIRECT_STATUS 200;
65 # NOTE: PHP only, required if PHP was built with --enable-force-cgi-redirect
66 fastcgi_pass_header Cookie;
67 fastcgi_pass_header Set-Cookie;
68 fastcgi_split_path_info ^(.+\.php)(/.+)$;
69
70 fastcgi_pass unix:/run/php5/fpm/davical;
71 }
72
73 # vim: ft=sh