mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-12-26 14:50:17 +00:00
Nginx wrapup with htpasswd basic auth, set the nginx.conf to your likings (if you use the newer raspberry pi's you can change the default from 1 to 2 or 4 worker processes)
parent
1b91985355
commit
710cc2c1dd
1 changed files with 33 additions and 0 deletions
|
@ -0,0 +1,33 @@
|
||||||
|
. apt-get -y install nginx php5-fpm apache2-utils #install necessary packages
|
||||||
|
. systemctl disable lighttpd #disable lighttpd at startup
|
||||||
|
. systemctl enable php5-fpm #enable php5-fpm at startup
|
||||||
|
. systemctl enable nginx #enable nginx at startup
|
||||||
|
. edit /etc/nginx/conf.d/default to:
|
||||||
|
----
|
||||||
|
server {
|
||||||
|
listen 80 default_server;
|
||||||
|
listen [::]:80 default_server;
|
||||||
|
root /var/www/html;
|
||||||
|
index index.html index.htm index.php;
|
||||||
|
server_name _;
|
||||||
|
autoindex off;
|
||||||
|
location / {
|
||||||
|
expires max;
|
||||||
|
return 204 'pixel';
|
||||||
|
}
|
||||||
|
location /admin{
|
||||||
|
root /var/www/html;
|
||||||
|
index index.php;
|
||||||
|
auth_basic "Restricted"; #For Basic Auth
|
||||||
|
auth_basic_user_file /etc/nginx/.htpasswd; #For Basic Auth
|
||||||
|
}
|
||||||
|
location ~ \.php$ {
|
||||||
|
include snippets/fastcgi-php.conf;
|
||||||
|
fastcgi_pass unix:/var/run/php5-fpm.sock;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
----
|
||||||
|
. htpasswd -c /etc/nginx/.htpasswd exampleuser #create username for authentication for the admin - we don't want other people in our network change our black and whitelist ;)
|
||||||
|
. service lighttpd stop #stop default lighttpd
|
||||||
|
. service php5-fpm start #start php5-fpm daemon
|
||||||
|
. service nginx start #start nginx webserver
|
Loading…
Reference in a new issue