|
1 | 1 | ### Notes & Warnings
|
2 | 2 |
|
3 | 3 | - **This is an unsupported configuration created by the community**
|
4 |
| -- **Replace `7.3` with the PHP version you installed, e.g. if you're using Raspbian Stretch (Debian 9) replace `7.3` with `7.0`.** |
5 |
| -- The `php7.3-sqlite3` package must be installed otherwise Networking and Querying will throw an error that it can't access the database. |
| 4 | +- **Replace `8.2` with the PHP version you installed, e.g. if you're using Raspbian Bullseye (Debian 11) replace `8.2` with `7.4`.** |
| 5 | +- The `php8.2-sqlite3` package must be installed otherwise Networking and Querying will throw an error that it can't access the database. |
6 | 6 |
|
7 | 7 | ### Basic requirements
|
8 | 8 |
|
9 |
| -1. Stop default lighttpd |
| 9 | +1. Stop and disable the default lighttpd web server |
10 | 10 |
|
11 | 11 | ```bash
|
12 |
| - service lighttpd stop |
| 12 | + systemctl disable --now lighttpd |
13 | 13 | ```
|
14 | 14 |
|
15 |
| -2. Install necessary packages |
| 15 | +2. Install the nginx package and ensure the necessary PHP packages are installed |
16 | 16 |
|
17 | 17 | ```bash
|
18 |
| - apt-get -y install nginx php7.3-fpm php7.3-cgi php7.3-xml php7.3-sqlite3 php7.3-intl apache2-utils |
| 18 | + apt-get -y install nginx php8.2-fpm php8.2-cgi php8.2-xml php8.2-sqlite3 php8.2-intl |
19 | 19 | ```
|
20 | 20 |
|
21 |
| -3. Disable lighttpd at startup |
| 21 | +3. Enable php8.2-fpm at startup and start the service |
22 | 22 |
|
23 | 23 | ```bash
|
24 |
| - systemctl disable lighttpd |
| 24 | + systemctl enable --now php8.2-fpm |
25 | 25 | ```
|
26 | 26 |
|
27 |
| -4. Enable php7.3-fpm at startup |
| 27 | +4. Enable nginx at startup and start the service |
28 | 28 |
|
29 | 29 | ```bash
|
30 |
| - systemctl enable php7.3-fpm |
| 30 | + systemctl enable --now nginx |
31 | 31 | ```
|
32 | 32 |
|
33 |
| -5. Enable nginx at startup |
34 |
| - |
35 |
| - ```bash |
36 |
| - systemctl enable nginx |
37 |
| - ``` |
38 |
| - |
39 |
| -6. Edit `/etc/nginx/sites-available/default` to: |
| 33 | +5. Replace the contents of `/etc/nginx/sites-available/default` with the following configuration. If necessary, adjust the PHP version number on the `fastcgi_pass` line to match your installation: |
40 | 34 |
|
41 | 35 | ```nginx
|
42 | 36 | server {
|
|
45 | 39 |
|
46 | 40 | root /var/www/html;
|
47 | 41 | server_name _;
|
48 |
| - autoindex off; |
49 | 42 |
|
50 | 43 | index pihole/index.php index.php index.html index.htm;
|
51 | 44 |
|
|
56 | 49 |
|
57 | 50 | location ~ \.php$ {
|
58 | 51 | include fastcgi_params;
|
| 52 | + fastcgi_split_path_info ^(.+?\.php)(/.*)$; |
| 53 | + fastcgi_param PATH_INFO $fastcgi_path_info; |
59 | 54 | fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
|
60 |
| - fastcgi_pass unix:/run/php/php7.3-fpm.sock; |
| 55 | + fastcgi_pass unix:/run/php/php8.2-fpm.sock; |
61 | 56 | fastcgi_param FQDN true;
|
62 |
| - auth_basic "Restricted"; # For Basic Auth |
63 |
| - auth_basic_user_file /etc/nginx/.htpasswd; # For Basic Auth |
64 | 57 | }
|
65 | 58 |
|
66 | 59 | location /*.js {
|
67 | 60 | index pihole/index.js;
|
68 |
| - auth_basic "Restricted"; # For Basic Auth |
69 |
| - auth_basic_user_file /etc/nginx/.htpasswd; # For Basic Auth |
70 | 61 | }
|
71 | 62 |
|
72 | 63 | location /admin {
|
73 | 64 | root /var/www/html;
|
74 | 65 | index index.php index.html index.htm;
|
75 |
| - auth_basic "Restricted"; # For Basic Auth |
76 |
| - auth_basic_user_file /etc/nginx/.htpasswd; # For Basic Auth |
77 |
| - } |
78 |
| -
|
79 |
| - location ~ /\.ht { |
80 |
| - deny all; |
81 | 66 | }
|
82 | 67 | }
|
83 | 68 | ```
|
84 | 69 |
|
85 |
| -7. Create a username for authentication for the admin - we don't want other people in our network change our black and whitelist ;) |
86 |
| - |
87 |
| - ```bash |
88 |
| - htpasswd -c /etc/nginx/.htpasswd exampleuser |
89 |
| - ``` |
90 |
| - |
91 |
| -8. Change ownership of the html directory to nginx user |
92 |
| - |
93 |
| - ```bash |
94 |
| - chown -R www-data:www-data /var/www/html |
95 |
| - ``` |
96 |
| - |
97 |
| -9. Make sure the html directory is writable |
98 |
| - |
99 |
| - ```bash |
100 |
| - chmod -R 755 /var/www/html |
101 |
| - ``` |
102 |
| - |
103 |
| -10. Grant the admin panel access to the gravity database |
104 |
| - |
105 |
| - ```bash |
106 |
| - usermod -aG pihole www-data |
107 |
| - ``` |
108 |
| - |
109 |
| -11. Start php7.3-fpm daemon |
110 |
| - |
111 |
| - ```bash |
112 |
| - service php7.3-fpm start |
113 |
| - ``` |
114 |
| - |
115 |
| -12. Start nginx web server |
| 70 | +6. Restart the nginx web server |
116 | 71 |
|
117 | 72 | ```bash
|
118 |
| - service nginx start |
| 73 | + systemctl restart nginx |
119 | 74 | ```
|
120 | 75 |
|
121 | 76 | ### Optional configuration
|
|
0 commit comments