Correction : évite de dépasser GROUP_NAME_MAX_LENGTH==32 .
[lhc/ateliers.git] / etc / nginx / site.d / 80.git.heureux-cyclage.org / server.conf
1 client_body_buffer_size 8k;
2 client_max_body_size 10m;
3 location / {
4 index index.html index.htm index.php;
5 }
6 location ~* ^.+.(css|gif|html|ico|jpeg|js|jpg|png|txt|xml)$ {
7 access_log off;
8 expires 30d;
9 log_not_found off;
10 }
11 location ~ /\. {
12 access_log off;
13 deny all;
14 log_not_found off;
15 }
16 location ~ ^.*\.git/objects/([0-9a-f]+/[0-9a-f]+|pack/pack-[0-9a-f]+.(pack|idx)) {
17 # NOTE: static repo files for cloning over HTTP
18 root /home/git/repositories/;
19 }
20 location ~ ^.*\.git/(HEAD|info/refs|objects/info/.*|git-(upload|receive)-pack)$ {
21 # NOTE: requests that need to go to git-http-backend
22 root /home/git/pub/git
23 fastcgi_param GIT_HTTP_EXPORT_ALL "";
24 fastcgi_param GIT_PROJECT_ROOT /home/git/pub/git;
25 fastcgi_param PATH_INFO $uri;
26 fastcgi_param REMOTE_USER $remote_user;
27 fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
28 }
29 location @gitweb {
30 include /etc/nginx/conf.d/fastcgi.conf;
31 set $no_cache "";
32 if ($request_method !~ ^(GET|HEAD)$) {
33 # NOTE: if non GET/HEAD, don't cache and mark user as uncacheable for 1 second via cookie.
34 set $no_cache "1";
35 }
36 if ($no_cache = "1") {
37 # NOTE: drop no cache cookie if need be (for some reason, add_header fails if included in prior if-block).
38 add_header Set-Cookie "_mcnc=1; Max-Age=2; Path=/";
39 add_header X-Microcachable "0";
40 }
41 if ($http_cookie ~* "_mcnc") {
42 # NOTE: bypass cache if no-cache cookie is set.
43 set $no_cache "1";
44 }
45 fastcgi_cache_bypass $no_cache;
46 fastcgi_cache_use_stale updating;
47 fastcgi_cache_valid 200 10s;
48 fastcgi_cache_valid 404 30m;
49 fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
50 fastcgi_max_temp_file_size 2M;
51 fastcgi_no_cache $no_cache;
52 fastcgi_param GITWEB_CONFIG /etc/gitweb/gitweb.conf;
53 fastcgi_param PATH_INFO $uri;
54 fastcgi_param SCRIPT_FILENAME /usr/share/gitweb/gitweb.cgi;
55
56 fastcgi_pass_header Cookie;
57 fastcgi_pass_header Set-Cookie;
58 fastcgi_split_path_info ^(.+\.php)(/.+)$;
59
60 fastcgi_pass unix:/run/nginx/fastcgi/fcgi.git.80.git.heureux-cyclage.org;
61 }
62 root /usr/share/gitweb;
63 ssl_session_timeout 5m;
64 try_files $uri @gitweb;
65 # NOTE: send anything else to gitweb if it's not a real file
66
67 # vim: ft=sh