mkdir /etc/nginx/conf.d/auth_pwd touch /etc/nginx/conf.d/auth_pwd/xx.pwd htpasswd -c -d /etc/nginx/conf.d/auth_pwd/xx.pwd username enter password nginx conf location / { uwsgi_pass 127.0.0.1:8002; include uwsgi_params; } location /admincp/ { auth_basic ‘password please.‘; auth_basic_user_file ‘conf.d/auth_pwd/hezi.pwd‘; uwsgi_pass 127.0.0.1:8002; include uwsgi_params; }
有的时候写个简单的程序,不想写后台验证,利用nginx 的auth_basic模块做简易权限认证。
针对目录。
时间: 2024-11-08 19:23:51