Install httpd-tools package first:
sudo yum install httpd-tools
If you are on Ubuntu install that package:
sudo apt-get install apache2-utils
Add to your nginx config:
server {
...
auth_basic "closed site";
auth_basic_user_file conf/htpasswd;
}
Go to /etc/nginx and create folder conf:
cd /etc/nginx
sudo mkdir conf
Then you need to generate file htpasswd that contains authentication data:
sudo htpasswd -c htpasswd admin
No comments:
Post a Comment