nginx-basic-auth
公司的安全团队扫描到我的系统后台直接暴露在公网,有安全问题,需要加上Basic Auth鉴权。
前置要求
需要安装httpd-tools(Centos), Debian系列需要安装apache2-utils
1 | yum install -u httpd-tools |
操作步骤
- 创建htpasswd文件
1 | htpasswd -c /usr/local/nginx/conf/htpasswd admin |
- 在nginx.conf里配置鉴权
1 | server { |
参考文档
https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/