Raspi - Wiki

Installation de RaspiOS

Outils pour utilisateurs

Outils du site


web:authentification

Ceci est une ancienne révision du document !


HTTP Authentification

Il faut commencer par créer des utilisateur, pour cela nous avons besoins de htpasswd pour gérer notre ficher chiffré d'utilisateurs. Afin d'accéder à cette commande, nous avons besoin d'installer le paquet apache2-utils.

sudo apt install apache2-utils
sudo htpasswd -c /etc/nginx/.htpasswd pi

Puis on configure nginx en editant le fichier /etc/nginx/sites-available/monsite

monsite
server {
	listen 80;
	listen [::]:80;
	root /var/www/monsite;
	index index.php index.html index.htm
	server_name monsite.com;
	location / {
                try_files $uri $uri/ =404;
		    auth_basic "Secure area - Authentication requise";
                    auth_basic_user_file /etc/nginx/.htpasswd;
		    }
	location ~ \.php$ {
		include snippets/fastcgi-php.conf;
		fastcgi_pass unix:/run/php/php7.4-fpm.sock;
		}
}
web/authentification.1645723119.txt.gz · Dernière modification : 2022/02/24 18:18 de michel