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