summaryrefslogtreecommitdiff
path: root/test/e2e/containers/git/etc/nginx/sites-enabled/git-http-auth
blob: 68e31b76c5e133627674f7a067c89f3b2da703e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
server {
  server_name         _;
  listen 8081         ssl;
  listen [::]:8081    ssl;

  ssl_certificate     localhost.crt;
  ssl_certificate_key localhost.key;
  ssl_protocols       TLSv1.2 TLSv1.3;

  auth_basic      "git";
  auth_basic_user_file "/etc/nginx/htpasswd";

  location /ping {
    add_header Content-Type text/plain;
    return 200 'pong';
  }

  location ~ ^.*\.git/objects/([0-9a-f]+/[0-9a-f]+|pack/pack-[0-9a-f]+.(pack|idx))$ {
    root            /var/lib/git;
  }

  location ~ ^.*\.git/(HEAD|info/refs|objects/info/.*|git-(upload|receive)-pack)$ {
    include         fastcgi_params;
    fastcgi_param   SCRIPT_FILENAME /usr/libexec/git-core/git-http-backend;
    fastcgi_param   GIT_HTTP_EXPORT_ALL "";
    fastcgi_param   GIT_PROJECT_ROOT /var/lib/git;
    fastcgi_param   PATH_INFO $uri;
    fastcgi_param   REMOTE_USER admin;
    fastcgi_pass    unix:/var/run/fcgiwrap.socket;
  }

  location / {
    try_files       $uri $uri/ =404;
  }
}