Use Pi-Hole with NGINX for HTTPS WebGUI Access
The default installation of Pi-Hole gives you an option to use the lighttpd webserver, which is a very lightweight webserver option, but it does not give you the option to enable or use HTTPS for accessing the WebGUI.
We can force the local Pi-Hole installation to use HTTPS with the help of NGINX.
Prerequisite
If you have already installed Pi-Hole on your system and chose to use lighttpd, run the following command to stop lighttpd and uninstall it:
#Stop lighttpd
sudo service lighttpd stop
#Stop lighttpd from starting at boot
sudo systemctl disable lighttpd
#Remove lighttpd
sudo apt purge lighttpd
Install PHP 8.1 Packages
If your base OS system (Debian 11 in my case) does not have the latest PHP repository, you can manually add the popular https://packages.sury.org/php/ PHP repository to your system.
Install gnupg to allow adding PHP 8.1 repository to the system.
sudo apt install gnupg
Add PHP repository and update package list.
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
wget -qO - https://packages.sury.org/php/apt.gpg | sudo apt-key add -
sudo apt update
Install required PHP packages for Pi-Hole. We will be using the latest PHP 8.1 versions.
sudo apt install php8.1-fpm php8.1-cgi php8.1-xml php8.1-sqlite3 php8.1-intl
Enable PHP FPM at startup.
sudo systemctl enable php8.1-fpm
Install NGINX
sudo apt install nginx