1.安装opennssl-devel
2.安装nginx的时候加载模块 --with-http_ssl_module
3.配置文件夹
http{
server{
listen 80;
server_name localhost;
root html;
auth_basic"这里输入提示可以随意写,但是不可以写中文“;
auth_basic_user_file "读取用户和密码的文件目录;
location / {
root html;
index index.html index.htm;
}
4.安装http-tools
htpasswd -c /mnt/nginx/pass tom 没有这个文件的是加-c 有的时候就不需要了
然后加载配置文件
5.测试
如何对Nginx进行用户认证
最新推荐文章于 2022-05-09 16:12:33 发布