Ajout : wiki.cyclocoop.org .
[lhc/ateliers.git] / etc / nginx / site.d / cyclo-wiki / site.conf
1 server_name
2 wiki.cyclocoop.org;
3
4 auth_basic "pour demander un compte: admin+wiki@cyclocoop.org";
5 auth_basic_user_file /home/www/data/cyclo-wiki/.htpasswd;
6 client_body_buffer_size 8k;
7 client_max_body_size 10m;
8 error_page 404 /cgi/ikiwiki.cgi?do=create&page=$uri;
9
10 location ~ ^/gitweb/static/.+\.(css|png|js)$ {
11 root /usr/share/;
12 access_log off;
13 expires 30d;
14 log_not_found off;
15 }
16 location ~ ^/gitweb($|/) {
17 root /usr/share/gitweb;
18 fastcgi_param SCRIPT_FILENAME /usr/share/gitweb/gitweb.cgi;
19 include /etc/nginx/conf.d/fastcgi.conf;
20 set $no_cache "0";
21 if ($request_method !~ ^(GET|HEAD)$) {
22 # NOTE: if non GET/HEAD, don't cache and mark user as uncacheable for 1 second via cookie.
23 set $no_cache "1";
24 }
25 if ($no_cache = "1") {
26 # NOTE: drop no cache cookie if need be (for some reason, add_header fails if included in prior if-block).
27 add_header Set-Cookie "_mcnc=1; Max-Age=2; Path=/";
28 add_header X-Microcachable "0";
29 }
30 if ($http_cookie ~* "_mcnc") {
31 # NOTE: bypass cache if no-cache cookie is set.
32 set $no_cache "1";
33 }
34 fastcgi_cache_bypass $no_cache;
35 fastcgi_cache_use_stale updating;
36 fastcgi_cache_valid 200 10s;
37 fastcgi_cache_valid 404 30m;
38 fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
39 fastcgi_no_cache $no_cache;
40 fastcgi_param GITWEB_CONFIG /etc/gitweb/cyclo-wiki.conf;
41 fastcgi_param PATH_INFO $uri;
42
43 fastcgi_pass_header Cookie;
44 fastcgi_pass_header Set-Cookie;
45 fastcgi_split_path_info ^(.+\.cgi)(/.+)$;
46
47 fastcgi_pass unix:/run/spawn-fcgi/gitweb;
48 }
49
50 location /cgi/ikiwiki.cgi {
51 include /etc/nginx/conf.d/fastcgi.conf;
52 fastcgi_index cgi/ikiwiki.cgi;
53 fastcgi_pass unix:/run/spawn-fcgi/cyclo-wiki;
54 }
55 location ~* ^.+\.(css|gif|html|ico|jpeg|js|jpg|png|txt|xml)$ {
56 access_log off;
57 expires 30d;
58 log_not_found off;
59 }
60 location ~ /\. {
61 access_log off;
62 deny all;
63 log_not_found off;
64 }
65 location / {
66 index index.html;
67 }
68
69 # vim: ft=sh