http2 on; access_log /var/log/nginx/access.log main; location /.well-known/ { root /var/www/localhost/htdocs; } location ~ "^/([^/]+)/(.+/objects/[0-9a-f]{2}/[0-9a-f]{38})$" { alias /home/$1/$2; add_header Handler "git object" always; } location ~ "^/[^/]+/.*\.git/(HEAD|info/refs|objects/(info/[^/]+|[0-9a-f]{2}/[0-9a-f]{38}|pack/pack-[0-9a-f]{40}\.(pack|idx))|git-(upload|receive)-pack)$" { fastcgi_pass 127.0.0.1:1733; include fastcgi-git-http-backend.conf; add_header Handler "git-http-backend" always; } location ~ /.+/ { fastcgi_pass 127.0.0.1:1733; include fastcgi-cgit.conf; add_header Handler "cgit" always; } location = / { try_files /dev/null @index; } location = /index.html { try_files /dev/null @index; } location @index { root /home/cgitspace/www/public; fastcgi_index index.html; try_files $uri $uri/ =404; fastcgi_pass unix:/run/php-fpm/cgit.sock; include fastcgi_params; } location / { if (-d /home/$uri) { return 301 $uri/; } root /home/cgitspace/www/public; try_files $uri $uri/ =404; } location ^~ /cgit/ { alias /usr/share/webapps/cgit/9999-r9999/htdocs/; add_header Handler "cgit-static" always; } location = /basic_status { stub_status; access_log off; allow 127.0.0.1; allow ::1; allow 10.0.0.0/24; allow 172.20.210.4; deny all; }