Modifications : etc/nginx/site.d/sympa/http.conf
[lhc/ateliers.git] / etc / nginx / site.d / sympa / site.conf
1 server_name
2 sympa.heureux-cyclage.org
3 sympa.cyclocoop.heureux-cyclage.org
4 sympa.cyclocoop.org
5 sympa.lesjantesdunord.heureux-cyclage.org
6 sympa.lesjantesdunord.org
7 sympa.ptitvelo.heureux-cyclage.org
8 sympa.ptitvelo.net;
9
10 client_body_buffer_size 8k;
11 client_max_body_size 10m;
12 location /static-sympa {
13 alias /var/lib/sympa/static_content;
14 }
15 location ~ /\. {
16 access_log off;
17 deny all;
18 log_not_found off;
19 }
20 location / {
21 include /etc/nginx/conf.d/fastcgi.conf;
22 set $no_cache "0";
23 if ($request_method !~ ^(GET|HEAD)$) {
24 # NOTE: if non GET/HEAD, don't cache and mark user as uncacheable for 1 second via cookie.
25 set $no_cache "1";
26 }
27 if ($no_cache = "1") {
28 # NOTE: drop no cache cookie if need be (for some reason, add_header fails if included in prior if-block).
29 add_header Set-Cookie "_mcnc=1; Max-Age=2; Path=/";
30 add_header X-Microcachable "0";
31 }
32 if ($http_cookie ~* "_mcnc") {
33 # NOTE: bypass cache if no-cache cookie is set.
34 set $no_cache "1";
35 }
36 fastcgi_cache_bypass $no_cache;
37 fastcgi_cache_use_stale updating;
38 fastcgi_cache_valid 200 10s;
39 fastcgi_cache_valid 404 30m;
40 fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
41 fastcgi_no_cache $no_cache;
42 fastcgi_param SCRIPT_NAME '';
43 set $sympa_robot $host;
44 if ($host = "sympa.cyclocoop.heureux-cyclage.org") {
45 set $sympa_robot "sympa.cyclocoop.org";
46 }
47 if ($host = "sympa.lesjantesdunord.heureux-cyclage.org") {
48 set $sympa_robot "sympa.lesjantesdunord.org";
49 }
50 if ($host = "sympa.ptitvelo.heureux-cyclage.org") {
51 set $sympa_robot "sympa.ptitvelo.net";
52 }
53 fastcgi_param SERVER_NAME $sympa_robot;
54 fastcgi_param PATH_INFO $uri;
55
56 fastcgi_pass_header Cookie;
57 fastcgi_pass_header Set-Cookie;
58 fastcgi_split_path_info ^(.+\.cgi)(/.+)$;
59
60 fastcgi_pass unix:/run/spawn-fcgi/sympa;
61 }
62
63 # vim: ft=sh