反向代理的Apache基本身份验证问题

Kan*_*ane 5 apache authentication ubuntu reverse-proxy jenkins

我想为在Ubuntu服务器12.04.1上运行的Apache的反向代理站点添加基本身份验证.

Web应用程序是在Java EE容器上运行的Jenkins.

我在httpd.conf中添加了以下配置,

ProxyPass         /jenkins/  http://localhost:8080/jenkins/¬
ProxyPassReverse  /jenkins/  http://localhost:8080/jenkins/¬
ProxyRequests     Off¬
ProxyPreserveHost On¬ 
¬
<Proxy http://localhost:8080/jenkins*>¬
  Order deny,allow¬
  Deny from all¬
? AllowOverride AuthConfig¬
? AuthType Basic¬
  AuthName "jenkins"¬
? AuthBasicProvider file¬
  AuthUserFile /etc/apache2/passfile¬
? Require valid-user¬
? Satisfy any¬
</Proxy>
Run Code Online (Sandbox Code Playgroud)

当我使用错误的密码或不存在的用户名进行身份验证时,我可以在error.log of apache中找到以下消息,

[星期六10月27日17:51:59 2012] [错误] [客户端222.128.175.95]用户kane:"/ jenkins /"验证失败:密码不匹配[星期六27 27:52:04 2012] [错误] [客户端222.128.175.95]用户阿拉丁未找到:/ jenkins /

passfile中使用正确的用户和密码时,不会记录任何消息.虽然我在网络浏览器中输入了正确的用户和密码,但验证对话框会再次提示.我也在apache的access.log中找到了以下输出,

222.128.175.95 - kane [27/Oct/2012:17:39:54 +0800]"GET/jenkins/HTTP/1.1"401 794" - ""Mozilla/5.0(Macintosh; Intel Mac OS X 10_8_2)AppleWebKit/537.4 (KHTML,像Gecko一样)Chrome/22.0.1229.94 Safari/537.4"

有谁知道如何使它工作?谢谢.

CIG*_*Guy 5

您是否也在 Jenkins 上启用了身份验证?有关设置说明,请参阅此链接:https : //wiki.jenkins-ci.org/display/JENKINS/Apache+frontend+for+security

特别注意这行说你不能同时在 Jenkins 和 Apache 中启用安全性,因为两者会冲突,导致你看到无限提示。不幸的是,您必须选择其中之一。

另请参阅此链接以获取有关 Apache + Jenkins 设置的更一般性讨论:https : //wiki.jenkins-ci.org/display/JENKINS/Running+Jenkins+behind+Apache