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