-
Notifications
You must be signed in to change notification settings - Fork 3
Set Password pada nginx
Muhamad Hanafiah Yahya edited this page Oct 3, 2022
·
1 revision
sudo apt-get update
sudo sh -c "echo -n 'myuser:' >> /etc/nginx/.htpasswd"
sudo sh -c "openssl passwd -apr1 >> /etc/nginx/.htpasswd"
cat /etc/nginx/.htpasswd
masukkan code di bawah
# /etc/nginx/site-enabled/default
location / {
# ...
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd;
}
service nginx restart