# yum install httpd-tools # yum install httpd-tools # yum install httpd-tools # yum install httpd-tools Htpasswd pass.db Your user name press Enter and then enter the password and then add it to the configuration items of nginx under server_name

auth_basic "login";
auth_basic_user_file /etc/nginx/pass.db; // This is the path where your password is stored by default if you do not set it separatelypass.db
Copy the code

Finally, restart nginx and run nginx -s reload. Then start the service and start your operation