已经快搞定了感觉胜利的曙光来了,先记录一下,怕以后忘记了这些坑
1.500错误,并且error log显示如下
No protocol handler was valid for the URL /gerrit. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.
解决办法:
a2enmod proxy_http
2.报错[2017-04-07 12:03:44,200] [HTTP-33] ERROR com.google.gerrit.httpd.auth.container.HttpLoginServlet : Unable to authenticate user byAuthorization request header. Check container or server configuration
网页显示错误如下:
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 '/':
如何解决?说实话,我没有找到问题的根源,只是这样解决出一个问题,解决一个问题,那样解决出一个问题,结果,我忘记怎么解决的了,问题的根源没有记录下来.
比较重要的是看gerrit和apache的log,出什么问题解决什么问题.
所以存下了配置,用作参考.
顺便说一下,我安装的gerrit2.12+apache2
vim /etc/apache2/httpd.conf
<VirtualHost [My_IP]:80>
ServerName [My_IP]
ProxyRequests Off
ProxyVia Off
ProxyPreserveHost On
<Proxy *:80>
Order deny,allow
Allow from all
</Proxy>
<Location '/login/'>
AuthType Basic
AuthName "YuhuiXU Gerrit Code Review"
Require valid-user
AuthBasicProvider file
AuthUserFile /usr/local/gerrit/etc/passwds
</Location>
AllowEncodedSlashes On
ProxyPass / http://[My_IP]:8081/
</VirtualHost>
vim /usr/local/gerrit/etc/gerrit.config
[gerrit]
basePath = git
canonicalWebUrl = http://test026:80/
[database]
type = mysql
hostname = localhost
database = reviewdb
username = gerrit
[index]
type = LUCENE
[auth]
type = HTTP
[receive]
enableSignedPush = false
[sendemail]
smtpServer = localhost
[container]
user = root
javaHome = /usr/lib/jvm/java-8-openjdk-amd64/jre
[sshd]
listenAddress = *:29418
[httpd]
listenUrl = http://[My_IP]:8081/
[cache]
directory = cache