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