server { root /var/www/html; server_name pihole.pumppi.dev; autoindex off; index pihole/index.php index.php index.html index.htm; location / { expires max; try_files $uri $uri/ =404; } location ~ \.php$ { include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; fastcgi_pass unix:/run/php-fpm/www.sock; fastcgi_param FQDN true; auth_basic "Restricted"; # For Basic Auth auth_basic_user_file /etc/nginx/.htpasswd; # For Basic Auth } location /*.js { index pihole/index.js; auth_basic "Restricted"; # For Basic Auth auth_basic_user_file /etc/nginx/.htpasswd; # For Basic Auth } location /admin { root /var/www/html; index index.php index.html index.htm; auth_basic "Restricted"; # For Basic Auth auth_basic_user_file /etc/nginx/.htpasswd; # For Basic Auth } location ~ /\.ht { deny all; } listen [::]:443 ssl; # managed by Certbot listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/pumppi.dev/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/pumppi.dev/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot } server { if ($host = pihole.pumppi.dev) { return 301 https://$host$request_uri; } # managed by Certbot listen 80; listen [::]:80; server_name pihole.pumppi.dev; return 404; # managed by Certbot }