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