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