File nginx.conf of Package pihole-admin-lte
#
# /etc/nginx/conf.d/pihole.conf
#
# Usage
# -----
#
# To enable, rename this file to adminlte.conf:
#
# # cp adminlte.conf.in adminlte.conf
#
# To use this configuration, you need to generate a password:
#
# # mkdir /etc/nginx/pass
# # chmod 750 /etc/nginx/pass
# # chmod root:nginx /etc/nginx/pass # to ensure no-one but nginx and root can read the password
# # htpasswd -c /etc/nginx/pass/htpasswd exampleuser
#
# Also remember to fix PHP settings to match your setup in your new adminlte.conf.
#
# Upgrading
# ---------
#
# Whenever this config gets updates, you can just do a diff between the template and your config:
#
# diff -u adminlte.conf adminlte.conf.in
#
# and then apply all modifications that may apply to you.
#
# Source for nginx config(2020-01-10): https://docs.pi-hole.net/guides/nginx-configuration/
#
server {
listen 80;
listen [::]:80;
root /srv/www/pihole;
server_name pihole.example.org;
autoindex off;
access_log /var/log/nginx/adminlte.access.log;
error_log /var/log/nginx/adminlte.error.log;
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 unix:/run/php-fpm/pihole.sock;
fastcgi_param FQDN true;
auth_basic "Restricted"; # For Basic Auth
auth_basic_user_file /etc/nginx/pass/htpasswd; # For Basic Auth
}
location /*.js {
index pihole/index.js;
auth_basic "Restricted"; # For Basic Auth
auth_basic_user_file /etc/nginx/pass/htpasswd; # For Basic Auth
}
location /admin {
index index.php index.html index.htm;
auth_basic "Restricted"; # For Basic Auth
auth_basic_user_file /etc/nginx/pass/htpasswd; # For Basic Auth
}
}