summaryrefslogtreecommitdiff
path: root/config-parabola-mgmt-nginx.PKGBUILD
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2018-08-26 14:35:46 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2018-08-26 14:35:46 -0400
commit0c2bf8bec3ff0f558785b29980c193b054c3b529 (patch)
tree13b9885d67ede3e33863264cee8d46d22bed735c /config-parabola-mgmt-nginx.PKGBUILD
parentd6801ddd960843ca9c503acb937e7b807852bcf8 (diff)
Rename everything from config-* to config-parabola-*
Diffstat (limited to 'config-parabola-mgmt-nginx.PKGBUILD')
-rw-r--r--config-parabola-mgmt-nginx.PKGBUILD62
1 files changed, 62 insertions, 0 deletions
diff --git a/config-parabola-mgmt-nginx.PKGBUILD b/config-parabola-mgmt-nginx.PKGBUILD
new file mode 100644
index 0000000..d1bf998
--- /dev/null
+++ b/config-parabola-mgmt-nginx.PKGBUILD
@@ -0,0 +1,62 @@
+. ${BUILDFILE%/*}/common.sh
+pkgver=20180826
+
+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 's/\$remote_addr;$/127.0.0.1; # $remote_addr; # Anonymize/'
+} | awk '/^$/{ s=1 } /./&&!x[$0]++{ if(s){print ""} print; s=0 }'
+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
+
+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
+}