【问题标题】:nginx basic auth don't work on windowsnginx 基本身份验证在 Windows 上不起作用
【发布时间】:2015-06-11 14:20:19
【问题描述】:

这是我的一部分 nginx conf (window2003 server)

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.exmaple.com网站提示我输入的用户名和密码(正确),一遍又一遍地重复这个提示。

  1. password_file 由 Mac OS 上的htpassword 命令创建。
  2. http://127.0.0.1:3000/xx/tomcat 应用代理。
  3. window 的nginx 版本为1.7.12

可能是 HttpBasicAuthModule with nginx 不支持 windows 平台?

【问题讨论】:

    标签: nginx basic-authentication


    【解决方案1】:

    它的;

    auth_basic  "Restricted";
    auth_basic_user_file  c:/xxx/password_file;
    

    http://forum.nginx.org/read.php?2,254125,254187#msg-254187

    【讨论】:

    • 修改了答案和示例。
    猜你喜欢
    • 2016-01-11
    • 1970-01-01
    • 1970-01-01
    • 2014-09-06
    • 2014-01-22
    • 1970-01-01
    • 2012-03-18
    • 2014-12-31
    • 2016-11-17
    相关资源
    最近更新 更多