Files
sh/nginx/authentication
2026-05-22 15:21:21 +08:00

14 lines
279 B
Plaintext

#install tolls
apt install apache2-utils -y
#add user
htpasswd -c /etc/nginx/.htpasswd myuser
#change nginx configuration
location / {
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd;
root /var/www/html;
index index.html index.htm;
}