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