blob: 11d62d2d94e374b47815896e99aeb456ac27fa0b (
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
. ${BUILDFILE%/*}/common.sh
pkgver=20170131
package() {
preamble
# #### Nginx
depends+=(nginx)
# `fastcgi.conf`, `fastcgi_params`, `scgi_params` and `uwsgi_params`
# have been edited to pass 127.0.0.1 as the client IP address to
# worker processes, to protect user privacy.
add-file -m755 usr/share/holo/files/10-"$pkgname"/etc/nginx/fastcgi.conf.holoscript <<EOF
#!/bin/sh
{
echo '# -*- Mode: nginx; nginx-indent-level: 8; indent-tabs-mode: t -*-'
echo
sed -e '/^# -\\*- /d' -e 's/\\\$remote_addr;\$/127.0.0.1; # \$remote_addr; # Anonymize/'
} | cat -s
EOF
ln -sfT fastcgi.conf.holoscript usr/share/holo/files/10-"$pkgname"/etc/nginx/fastcgi_params.holoscript
ln -sfT fastcgi.conf.holoscript usr/share/holo/files/10-"$pkgname"/etc/nginx/scgi_params.holoscript
ln -sfT fastcgi.conf.holoscript usr/share/holo/files/10-"$pkgname"/etc/nginx/uwsgi_params.holoscript
# `mime.types` has had xz, gzip, bzip2, tar, PGP (`.sig`), and
# bittorrent types added to it. This list was based on the unmatched
# file extensions that `find` turned up on `repo.parabola.nu`.
add-file -m755 usr/share/holo/files/10-"$pkgname"/etc/nginx/mime.types.holoscript <<EOF
#!/bin/sh
{
echo '# -*- Mode: nginx; nginx-indent-level: 4; indent-tabs-mode: nil -*-'
echo
sed -e '
/types {/ {
a\\ application/x-xz xz;
a\\ application/x-gzip gz;
a\\ application/x-bzip2 bz2;
a\\ application/x-tar tar;
a\\ application/octet-stream sig;
a\\ application/x-bittorrent torrent;
a\\
}'
} | awk '\$0==""||!x[\$0]++' | cat -s
EOF
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
}
|