在ubuntu上配置好gerrit后,出现代理问题。
1.rrit.config如下:
[gerrit]
basePath = git
canonicalWebUrl = http://192.168.0.60:8083/
[database]
type = h2
database = db/ReviewDB
[auth]
type = HTTP
[sendemail]
smtpServer = localhost
[container]
user = gerrit
javaHome = /usr/lib/jvm/jdk1.7.0_65/jre
[sshd]
listenAddress = *:29418
[httpd]
listenUrl = proxy-http://192.168.0.60:8083/
[cache]
directory = cache
2./etc/apache2/httpd.conf 之前的配置为
<VirtualHost *>
ServerName localhost
ProxyRequests Off
ProxyVia Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location /login >
AuthType Basic
AuthName "Gerrit Code Review"
Require valid-user
AuthBasicProvider file
AuthUserFile /home/gerrit/review_site/etc/passwords
</Location>
AllowEncodedSlashes On
ProxyPass / http://192.168.0.60:8083/
</VirtualHost>
访问本机http://192.168.0.60:8083/ ,提示:
Configuration Error
Check the HTTP server’s authentication settings.
The HTTP server did not provide the username in the Authorization header when it forwarded the request to Gerrit Code Review.
If the HTTP server is Apache HTTPd, check the proxy configuration includes an authorization directive with the proper location, ensuring it ends with ‘/’:
改为配置多端口来解决。
1.首先在/etc/apache2/ports.conf中添加
NameVirtualHost *:8084
Listen 8084
2.配置/etc/apache2/httpd.conf:
<VirtualHost *:8084>
ServerName localhost
ProxyRequests Off
ProxyVia Off
ProxyPreserveHost On
<Proxy *:8084>
Order deny,allow
Allow from all
</Proxy>
<Location /login >
AuthType Basic
AuthName "Gerrit Code Review"
Require valid-user
AuthBasicProvider file
AuthUserFile /home/gerrit/review_site/etc/passwords
</Location>
AllowEncodedSlashes On
ProxyPass / http://192.168.0.60:8083/
</VirtualHost>
打开http://192.168.0.60:8084/#/,会跳转到http://192.168.0.60:8083/#/中进行登录。
配置完毕。