e8010a48fd28174f5c5161c081fb2520d258f599
[lhc/ateliers.git] / etc / nginx / site.d / lhc-remorque / site.conf
1 server_name
2 remorque.heureux-cyclage.org
3 ra.heureux-cyclage.org;
4
5 auth_basic "pour demander un compte: admin@heureux-cyclage.org";
6 auth_basic_user_file /home/www/pub/lhc-remorque/.htpasswd;
7 client_body_buffer_size 8k;
8 client_max_body_size 10m;
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/lhc-remorque.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 / {
51 index index.xhtml;
52 }
53 location ~* ^.+.(css|gif|html|ico|jpeg|js|jpg|png|txt|xml)$ {
54 access_log off;
55 expires 30d;
56 log_not_found off;
57 }
58 location ~ /\. {
59 access_log off;
60 deny all;
61 log_not_found off;
62 }
63 location /cgi/ikiwiki.cgi {
64 include /etc/nginx/conf.d/fastcgi.conf;
65 fastcgi_index cgi/ikiwiki.cgi;
66 fastcgi_pass unix:/run/spawn-fcgi/lhc-remorque;
67 }
68
69 # vim: ft=sh