summaryrefslogtreecommitdiff
path: root/server.conf
blob: 0b5029e98ff0c7d76a50316fbcc4cb0affd2bb4d (about) (plain) (blame)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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;
}