Ajouts : etc/nginx/site.d/lhc-questionnaires{-tls}
[lhc/ateliers.git] / etc / nginx / site.d / lhc-questionnaires / site.conf
1 server_name questionnaires.heureux-cyclage.org;
2
3 client_body_buffer_size 8k;
4 client_max_body_size 10m;
5 location / {
6 index index.html index.htm index.php;
7 }
8 location ~* ^.+.(css|gif|html|ico|jpeg|js|jpg|png|txt|xml)$ {
9 access_log off;
10 expires 30d;
11 log_not_found off;
12 }
13 location ~ /\. {
14 access_log off;
15 deny all;
16 log_not_found off;
17 }
18 location ~ \.php$ {
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_max_temp_file_size 2M;
41 fastcgi_no_cache $no_cache;
42 fastcgi_param REDIRECT_STATUS 200;
43 # NOTE: PHP only, required if PHP was built with --enable-force-cgi-redirect
44 fastcgi_pass_header Cookie;
45 fastcgi_pass_header Set-Cookie;
46 fastcgi_split_path_info ^(.+\.php)(/.+)$;
47
48 fastcgi_pass unix:/run/php5/fpm/lhc_quest;
49 }
50
51 # vim: ft=sh