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