Modifications : etc/nginx/site.d/lhc-questionnaires/site.conf - Faute de
[lhc/ateliers.git] / etc / nginx / site.d / lhc-questionnaires / site.conf
1 server_name questionnaires.heureux-cyclage.org formations.heureux-cyclage.org;
2
3 client_body_buffer_size 8k;
4 client_max_body_size 10m;
5 location / {
6 if ($host = "formations.heureux-cyclage.org") {
7 return 302 "$scheme://questionnaires.heureux-cyclage.org/index.php?r=survey/index/sid/533927/lang/fr";
8 }
9 index index.html index.htm index.php;
10 }
11 location ~* ^.+\.(css|gif|html|ico|jpeg|js|jpg|png|txt|xml)$ {
12 access_log off;
13 expires 30d;
14 log_not_found off;
15 }
16 location ~ /\. {
17 access_log off;
18 deny all;
19 log_not_found off;
20 }
21 location ~ \.php$ {
22 include /etc/nginx/conf.d/fastcgi.conf;
23 set $no_cache "0";
24 if ($args = "r=admin/survey/sa/view/surveyid/933958") {
25 return 403;
26 }
27 if ($args = "r=admin/survey/sa/view/surveyid/933958") {
28 return 403;
29 }
30 if ($args = "r=survey/index/sid/933958/lang/fr") {
31 return 403;
32 }
33 if ($args = "r=survey/index/sid/933958/lang/en") {
34 return 403;
35 }
36 if ($args = "r=survey/index/sid/933958/lang/es") {
37 return 403;
38 }
39 if ($args = "r=survey/index/sid/933958/lang/it-informal") {
40 return 403;
41 }
42 if ($args = "r=survey/index/sid/933958/") {
43 return 403;
44 }
45 if ($args = "r=survey/index/sid/933958/newtest/Y") {
46 return 403;
47 }
48 if ($request_method !~ ^(GET|HEAD)$) {
49 # NOTE: if non GET/HEAD, don't cache and mark user as uncacheable for 1 second via cookie.
50 set $no_cache "1";
51 }
52 if ($no_cache = "1") {
53 # NOTE: drop no cache cookie if need be (for some reason, add_header fails if included in prior if-block).
54 add_header Set-Cookie "_mcnc=1; Max-Age=2; Path=/";
55 add_header X-Microcachable "0";
56 }
57 if ($http_cookie ~* "_mcnc") {
58 # NOTE: bypass cache if no-cache cookie is set
59 set $no_cache "1";
60 }
61 fastcgi_cache_bypass $no_cache;
62 fastcgi_cache_use_stale updating;
63 fastcgi_cache_valid 200 10s;
64 fastcgi_cache_valid 404 10m;
65 fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
66 fastcgi_index index.php;
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/lhc_quest;
75 }
76
77 # vim: ft=sh