summarylogtreecommitdiffstats
path: root/nginx.pi-hole.conf
diff options
context:
space:
mode:
authormax.bra2017-10-09 17:52:26 +0200
committermax.bra2017-10-09 17:52:26 +0200
commit5d4099f6c73240396776b2f73af27cb61f0471cb (patch)
treee37a8019843e44e29dcf672cda9201ff0ae2e259 /nginx.pi-hole.conf
parent4c190e47d1044c38acd325182922b71598fd16d7 (diff)
downloadaur-5d4099f6c73240396776b2f73af27cb61f0471cb.tar.gz
removed lighttpd open_basedir, aligned nginx conf to lighttpd one
Diffstat (limited to 'nginx.pi-hole.conf')
-rw-r--r--nginx.pi-hole.conf50
1 files changed, 44 insertions, 6 deletions
diff --git a/nginx.pi-hole.conf b/nginx.pi-hole.conf
index 895bc839cce4..a24e38381d7d 100644
--- a/nginx.pi-hole.conf
+++ b/nginx.pi-hole.conf
@@ -1,26 +1,64 @@
# place in /etc/nginx/conf.d/pihole.conf
-server {
+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$ {
+ fastcgi_param HTTP_HOST localhost;
+ fastcgi_param HTTP_ORIGIN localhost;
+ fastcgi_pass 127.0.0.1:9000;
+ fastcgi_index index.php;
+ include fastcgi.conf;
+ }
+}
+
+server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
- root /srv/http/pihole/admin;
+ 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 ~ /\. {
- deny all;
+ 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$ {
+ fastcgi_intercept_errors on;
fastcgi_param HTTP_HOST localhost;
fastcgi_param HTTP_ORIGIN localhost;
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.php;
+ fastcgi_pass 127.0.0.1:9000;
+ fastcgi_index index.php;
include fastcgi.conf;
}
}