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