Nginx基本身份验证在Windows上无法正常工作。

3
这是我的 Nginx 配置文件的一部分(Windows Server 2003)。
server {
  listen 80;
  server_name  xxx.example.com;
  access_log  logs/example.com.log;

  location / {
    auth_basic  "Restricted";
    auth_basic_user_file  c:/xxx/password_file;
    proxy_set_header  Authorization "";
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-Server $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_pass   http://127.0.0.1:3000/xx/;
  }
}

访问 xxx.example.com 网站提示我输入用户名和密码(正确),但是这个提示一遍又一遍地出现。

  1. htpassword 命令在 Mac OS 上创建了 password_file。
  2. http://127.0.0.1:3000/xx/ 是 tomcat 应用程序的代理。
  3. Windows 平台的 nginx 版本是 1.7.12

也许 HttpBasicAuthModule 与 nginx 不支持 Windows 平台?

1个回答

1

已经修正并附上答案和示例。 - itpp13

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接