summarylogtreecommitdiffstats
path: root/nginx.pi-hole.conf
blob: b7cd87eac349ba8b81264fe8e7200369e815e39b (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
#
# /etc/nginx/conf.d/pihole.conf
#
# https://github.com/pi-hole/pi-hole/wiki/Nginx-Configuration
#

server {
	listen 80 default_server;
	listen [::]:80 default_server;

	root /srv/http/pihole;
	server_name _;
	autoindex off;

	proxy_intercept_errors on;
	error_page 404 /pihole/index.php;

	index pihole/index.php index.php index.html index.htm;

	location / {
		expires max;
		try_files $uri $uri/ =404;
		add_header X-Pi-hole "A black hole for Internet advertisements";
	}

	location ~ \.php$ {
		include fastcgi.conf;
		fastcgi_intercept_errors on;
		fastcgi_pass  127.0.0.1:9000;
		fastcgi_param SERVER_NAME $host;
	}
	
	location /admin {
		root /srv/http/pihole;
		index index.php index.html index.htm;
		add_header X-Pi-hole "The Pi-hole Web interface is working!";
		add_header X-Frame-Options "DENY";
	}
	
	location ~ /\.ttf {
		add_header Access-Control-Allow-Origin "*";
	}

	location ~ /admin/\. {
		deny all;
	}

	location ~ /\.ht {
		deny all;
	}
}