File nginx.conf of Package pihole-admin-lte
xxxxxxxxxx
1
#
2
# /etc/nginx/conf.d/pihole.conf
3
#
4
# Usage
5
# -----
6
#
7
# To enable, rename this file to adminlte.conf:
8
#
9
# # cp adminlte.conf.in adminlte.conf
10
#
11
# To use this configuration, you need to generate a password:
12
#
13
# # mkdir /etc/nginx/pass
14
# # chmod 750 /etc/nginx/pass
15
# # chmod root:nginx /etc/nginx/pass # to ensure no-one but nginx and root can read the password
16
# # htpasswd -c /etc/nginx/pass/htpasswd exampleuser
17
#
18
# Also remember to fix PHP settings to match your setup in your new adminlte.conf.
19
#
20
# Upgrading
21
# ---------
22
#
23
# Whenever this config gets updates, you can just do a diff between the template and your config:
24
#
25
# diff -u adminlte.conf adminlte.conf.in
26
#
27
# and then apply all modifications that may apply to you.
28
#
29
# Source for nginx config(2020-01-10): https://docs.pi-hole.net/guides/nginx-configuration/
30
#
31
32
server {
33
listen 80;
34
listen [::]:80;
35
36
root /srv/www/pihole;
37
server_name pihole.example.org;
38
autoindex off;
39
40
access_log /var/log/nginx/adminlte.access.log;
41
error_log /var/log/nginx/adminlte.error.log;
42
43
index pihole/index.php index.php index.html index.htm;
44
45
location / {
46
expires max;
47
try_files $uri $uri/ =404;
48
}
49
50
location ~ \.php$ {
51
include fastcgi.conf;
52
fastcgi_pass unix:/run/php-fpm/pihole.sock;
53
fastcgi_param FQDN true;
54
auth_basic "Restricted"; # For Basic Auth
55
auth_basic_user_file /etc/nginx/pass/htpasswd; # For Basic Auth
56
}
57
58
location /*.js {
59
index pihole/index.js;
60
auth_basic "Restricted"; # For Basic Auth
61
auth_basic_user_file /etc/nginx/pass/htpasswd; # For Basic Auth
62
}
63
64
location /admin {
65
index index.php index.html index.htm;
66
auth_basic "Restricted"; # For Basic Auth
67
auth_basic_user_file /etc/nginx/pass/htpasswd; # For Basic Auth
68
}
69
}