这是我的 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
网站提示我输入用户名和密码(正确),但是这个提示一遍又一遍地出现。
htpassword
命令在 Mac OS 上创建了 password_file。- http://127.0.0.1:3000/xx/ 是 tomcat 应用程序的代理。
- Windows 平台的 nginx 版本是
1.7.12
。
也许 HttpBasicAuthModule 与 nginx 不支持 Windows 平台?