简单安装
nginx教程
加basic auth
- 创建密码文件(Using the OpenSSL Utilities)
sudo sh -c "echo -n 'username:' >> /etc/nginx/sites-enabled/.htpasswd"
sudo sh -c "openssl passwd -apr1 >> /etc/nginx/sites-enabled/.htpasswd"
- 配置nginx.conf
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd;