1 client_body_buffer_size 8k;
2 client_max_body_size 10m;
4 index index.html index.htm index.php;
6 location ~* ^.+.(css|gif|html|ico|jpeg|js|jpg|png|txt|xml)$ {
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/;
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;
30 include /etc/nginx/conf.d/fastcgi.conf;
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.
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";
41 if ($http_cookie ~* "_mcnc") {
42 # NOTE: bypass cache if no-cache cookie is set.
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;
56 fastcgi_pass_header Cookie;
57 fastcgi_pass_header Set-Cookie;
58 fastcgi_split_path_info ^(.+\.php)(/.+)$;
60 fastcgi_pass unix:/run/nginx/fastcgi/fcgi.git.80.git.heureux-cyclage.org;
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