144ed9c010d4417e734615207c165b60c785f8a7
[lhc/ateliers.git] / etc / nginx / site.d / agendav / site.conf
1 server_name
2 agendav.heureux-cyclage.org
3 agendav.cyclocoop.org;
4
5 client_body_buffer_size 8k;
6 client_max_body_size 10m;
7
8 location / {
9 root /home/www/pub/agendav/web/public/;
10 index index.html index.htm index.php;
11 }
12 location ~ /\. {
13 access_log off;
14 deny all;
15 log_not_found off;
16 }
17 location ~* ^.+\.php(|/.*)$ {
18 root /home/www/pub/agendav/web/public/;
19 include /etc/nginx/conf.d/fastcgi.conf;
20 set $no_cache "0";
21 if ($request_method !~ ^(GET|HEAD)$) {
22 # NOTE: if non GET/HEAD, don't cache and mark user as uncacheable for 1 second via cookie.
23 set $no_cache "1";
24 }
25 if ($no_cache = "1") {
26 # NOTE: drop no cache cookie if need be (for some reason, add_header fails if included in prior if-block).
27 add_header Set-Cookie "_mcnc=1; Max-Age=2; Path=/";
28 add_header X-Microcachable "0";
29 }
30 if ($http_cookie ~* "_mcnc") {
31 # NOTE: bypass cache if no-cache cookie is set
32 set $no_cache "1";
33 }
34 fastcgi_cache_bypass $no_cache;
35 fastcgi_cache_use_stale updating;
36 fastcgi_cache_valid 200 10s;
37 fastcgi_cache_valid 404 10m;
38 fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
39 fastcgi_index index.php;
40 fastcgi_split_path_info ^(.+\.php)(/.+)$;
41 fastcgi_param PATH_INFO $fastcgi_path_info;
42 fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
43 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
44 fastcgi_no_cache $no_cache;
45 fastcgi_param REDIRECT_STATUS 200;
46 # NOTE: PHP only, required if PHP was built with --enable-force-cgi-redirect
47 fastcgi_pass_header Cookie;
48 fastcgi_pass_header Set-Cookie;
49
50 fastcgi_pass unix:/run/php5/fpm/agendav;
51 }
52 location ~* ^.+.(css|gif|html|ico|jpeg|js|jpg|png|txt|xml)$ {
53 root /home/www/pub/agendav/web/public/;
54 access_log off;
55 expires 30d;
56 log_not_found off;
57 }
58
59 # vim: ft=sh