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