您的位置:首页 > 运维架构 > Nginx

nginx访问web界面验证

2016-11-30 15:43 183 查看
为了安全起见,部署的web内容不想让别人看到,或者为了增强安全性。
部署步骤:
首先利用apache的htpasswd功能生成一个用户名和密码:

htpasswd -c /usr/local/nginx/conf/test.pass test
New password:123456
2.在nginx配置文件location中添加如下两行:
location / {
root   /usr/share;
index  index.php index.html index.htm;
auth_basic "Authorized users only";
auth_basic_user_file conf/test.pass;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息