summaryrefslogtreecommitdiff
path: root/config-mgmt-nginx.PKGBUILD
blob: 6d7f8a18f2cb1811b4f8868941a5be3681ff5a25 (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
37
38
39
40
41
42
43
44
45
46
47
. ${BUILDFILE%/*}/common.sh
pkgver=20161111.2

package() {
preamble

depends+=(nginx)

add-file etc/nginx/sites/alias-parabolagnulinux_org.conf <<EOF
# -*- Mode: nginx; nginx-indent-level: 8; indent-tabs-mode: t -*-
# Redirect everything from *.parabolagnulinux.org to *.parabola.nu

# Top-level domain
server {
	server_name parabolagnulinux.org;
	listen 443 ssl http2;
	listen [::]:443 ssl http2;

	location / { return 301 https://www.parabola.nu\$request_uri; }
}

# Wildcard sub-domain
server {
	server_name ~^(?<subdomain>[^\\.]*)\\.parabolagnulinux\\.org\$;
	listen 443 ssl http2;
	listen [::]:443 ssl http2;

	location / { return 301 https://\$subdomain.parabola.nu\$request_uri; }
}
EOF

add-file etc/nginx/sites/meta-unknown-domain.conf <<EOF
# -*- Mode: nginx; nginx-indent-level: 8; indent-tabs-mode: t -*-

server {
	listen 443 ssl http2 default_server;
	listen [::]:443 ssl http2 default_server;

	return 301 https://www.parabola.nu/404;
}
EOF

add-unit etc/systemd/system/multi-user.target.wants/nginx.service

postamble
}