====== 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**//
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;
}
}
Et comme pour virtualhost il faut recharger la configuration de NGINX
{{counter}}