Generate htpasswd file for nginx in Ubuntu


$sudo apt-get update
$sudo apt-get install apache2-utils
$sudo htpasswd -c /etc/nginx/.htpasswd [username]
$cat /etc/nginx/.htpasswd

location / {
try_files $uri $uri/ =404;
auth_basic “Restricted Content”;
auth_basic_user_file /etc/nginx/.htpasswd;
}

$sudo service nginx restart

  •  
  •  
  •  
  •  

Viet Luu has written 318 articles

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Buy Me A Coffee

We are thankful for your never ending support.

Leave a Reply