diff options
author | graysky | 2017-10-30 16:54:26 -0400 |
---|---|---|
committer | graysky | 2017-10-30 16:54:26 -0400 |
commit | 033d32553be8c531fe36a4f0a1645b096f0617e3 (patch) | |
tree | 73bbf8d5eb0a6d06307c55ca43646c3cfe2461b0 | |
parent | 8415bdcec77b5699d9c8de0efad951b0b051cc0a (diff) | |
download | aur-033d32553be8c531fe36a4f0a1645b096f0617e3.tar.gz |
fix nginx redirect but lighttpd is still broken
-rw-r--r-- | .SRCINFO | 8 | ||||
-rw-r--r-- | PKGBUILD | 12 | ||||
-rw-r--r-- | fix_redirect.patch | 15 | ||||
-rw-r--r-- | nginx.pi-hole.conf | 99 |
4 files changed, 65 insertions, 69 deletions
@@ -1,7 +1,9 @@ +# Generated by mksrcinfo v8 +# Mon Oct 30 20:54:26 UTC 2017 pkgbase = pi-hole-server pkgdesc = The Pi-hole is an advertising-aware DNS/Web server. Arch adaptation for lan wide DNS server. pkgver = 3.1.4 - pkgrel = 6 + pkgrel = 7 url = https://github.com/pi-hole/pi-hole install = pi-hole-server.install arch = any @@ -34,12 +36,13 @@ pkgbase = pi-hole-server source = mimic_setupVars.conf.sh source = version.patch source = issue_1598.patch + source = fix_redirect.patch md5sums = e231722332116b7ffab316d5c66a828e md5sums = 2c0bf61ec96bdb85edeb9fd2cc2f330b md5sums = 3f1aeea43af0b192edb36b9e5484ff87 md5sums = 7ac346581ada71187b7fd18f164bbee9 md5sums = fec45782a36ea18c25743cbeeb4ef340 - md5sums = 70675dcc056ee056d31c566f5237c8d2 + md5sums = 55ffed9e2ce658211a16db81bbff02ed md5sums = 990b8abd0bfbba23a7ce82c59f2e3d64 md5sums = 047f13d4ac97877f724f87b002aaee63 md5sums = d42a864f88299998f8233c0bc0dd093d @@ -48,6 +51,7 @@ pkgbase = pi-hole-server md5sums = e364945acb83d6bec021a40a8642aca6 md5sums = 93fe5e50cf3fcb08b24cf29b0cace85b md5sums = d99fea037caefd6c7ab21a963d49afc6 + md5sums = b03c33b99dfcdc007f4fd969e4f3e9c9 pkgname = pi-hole-server @@ -4,7 +4,7 @@ pkgname=pi-hole-server _pkgname=pi-hole pkgver=3.1.4 -pkgrel=6 +pkgrel=7 _wwwpkgname=AdminLTE _wwwpkgver=3.1 pkgdesc='The Pi-hole is an advertising-aware DNS/Web server. Arch adaptation for lan wide DNS server.' @@ -36,14 +36,16 @@ source=(pihole-$pkgver.tar.gz::https://github.com/$_pkgname/$_pkgname/archive/v$ $_pkgname-logtruncate.timer mimic_setupVars.conf.sh version.patch - issue_1598.patch) + issue_1598.patch + fix_redirect.patch + ) md5sums=('e231722332116b7ffab316d5c66a828e' '2c0bf61ec96bdb85edeb9fd2cc2f330b' '3f1aeea43af0b192edb36b9e5484ff87' '7ac346581ada71187b7fd18f164bbee9' 'fec45782a36ea18c25743cbeeb4ef340' - '70675dcc056ee056d31c566f5237c8d2' + '55ffed9e2ce658211a16db81bbff02ed' '990b8abd0bfbba23a7ce82c59f2e3d64' '047f13d4ac97877f724f87b002aaee63' 'd42a864f88299998f8233c0bc0dd093d' @@ -51,7 +53,8 @@ md5sums=('e231722332116b7ffab316d5c66a828e' '291d3c95e445fe65caf40c3605efd186' 'e364945acb83d6bec021a40a8642aca6' '93fe5e50cf3fcb08b24cf29b0cace85b' - 'd99fea037caefd6c7ab21a963d49afc6') + 'd99fea037caefd6c7ab21a963d49afc6' + 'b03c33b99dfcdc007f4fd969e4f3e9c9') prepare() { _ssc="/tmp/sedcontrol" @@ -227,6 +230,7 @@ prepare() { cd "$srcdir"/"$_pkgname"-"$pkgver" patch -p1 -i "$srcdir"/version.patch patch -p1 -i "$srcdir"/issue_1598.patch # issue 1598 -> https://github.com/pi-hole/pi-hole/issues/1598 + patch -Np1 -i ../fix_redirect.patch cd "$srcdir" sed -n "/{{corever}}/w $_ssc" "$srcdir"/$_pkgname-$pkgver/advanced/Scripts/version.sh diff --git a/fix_redirect.patch b/fix_redirect.patch new file mode 100644 index 000000000000..f042d7813fd7 --- /dev/null +++ b/fix_redirect.patch @@ -0,0 +1,15 @@ +--- a/advanced/index.php 2017-10-30 16:27:08.583096709 -0400 ++++ b/advanced/index.php 2017-10-30 16:28:06.884263996 -0400 +@@ -10,7 +10,10 @@ function validIP($address){ + } + + $uri = escapeshellcmd($_SERVER['REQUEST_URI']); +-$serverName = escapeshellcmd($_SERVER['SERVER_NAME']); ++// To retain the functionality of the block page when directly accessing blacklisted domains ++// See: https://github.com/pi-hole/pi-hole/wiki/Nginx-Configuration ++// $serverName = escapeshellcmd($_SERVER['SERVER_NAME']); ++$serverName = escapeshellcmd($_SERVER['HTTP_HOST']); + + // If the server name is 'pi.hole', it's likely a user trying to get to the admin panel. + // Let's be nice and redirect them. + diff --git a/nginx.pi-hole.conf b/nginx.pi-hole.conf index 494c32c5ee71..f0098b41265b 100644 --- a/nginx.pi-hole.conf +++ b/nginx.pi-hole.conf @@ -1,67 +1,40 @@ -# place in /etc/nginx/conf.d/pihole.conf +# +# /etc/nginx/conf.d/pihole.conf +# +# https://github.com/pi-hole/pi-hole/wiki/Nginx-Configuration +# server { - listen 80; - listen [::]:80; - server_name pi.hole; - - root /srv/http/pihole; - index index.php; - - if ( $request_uri = / ) { - rewrite ^/$ $scheme://$host/admin/ permanent; - } - - location /admin { - try_files $uri $uri/ /index.php; - add_header X-Pi-hole "The Pi-hole Web interface is working!"; - add_header X-Frame-Options "DENY"; - } - - location ~ \.php$ { - include fastcgi.conf; - - fastcgi_param HTTP_HOST localhost; - fastcgi_param HTTP_ORIGIN localhost; - fastcgi_pass 127.0.0.1:9000; - fastcgi_index index.php; - } + listen 80 default_server; + listen [::]:80 default_server; + + root /srv/http/pihole; + server_name _; + autoindex off; + + index pihole/index.php index.php index.html index.htm; + + location / { + expires max; + try_files $uri $uri/ =404; + } + + location ~ \.php$ { + include fastcgi.conf; + fastcgi_pass 127.0.0.1:9000; + } + + location /*.js { + index pihole/index.js; + } + + location /admin { + root /srv/http/pihole; + index index.php index.html index.htm; + } + + location ~ /\.ht { + deny all; + } } -server { - listen 80 default_server; - listen [::]:80 default_server; - server_name _; - - root /srv/http/pihole; - index index.php; - - proxy_intercept_errors on; - error_page 404 /pihole/index.php; - - if ( $request_uri ~ ^(?!/pihole/)(?!/admin/).*\.js$ ) { - rewrite ^.*\.js$ $scheme://$host/pihole/index.js permanent; - } - - location / { - try_files $uri $uri/ /index.php; - add_header X-Pi-hole "A black hole for Internet advertisements"; - } - - location /admin { - try_files $uri $uri/ /index.php; - add_header X-Pi-hole "The Pi-hole Web interface is working!"; - add_header X-Frame-Options "DENY"; - } - - location ~ \.php$ { - include fastcgi.conf; - - fastcgi_intercept_errors on; - fastcgi_param HTTP_HOST localhost; - fastcgi_param HTTP_ORIGIN localhost; - fastcgi_param SERVER_NAME $host; - fastcgi_pass 127.0.0.1:9000; - fastcgi_index index.php; - } -} |