shell > yum -y install httpd- tools # Install htpasswd tools shell > cd /usr/local/nginx-1.10.2/conf shell > htpasswd - c pass.db wang # Create an authentication user wang and enter a password, enter htpasswd pass.db username when adding a user shell > vim /usr/local/nginx-1.10.2/conf/vhost/local.conf server { listen 80; server_name local.server.com; auth_basic "User Authentication"; auth_basic_user_file /usr/local/nginx/conf/pass.db; location / { root /data/www; index index.html; } }