Ubuntu 建立 Gerrit服务器 配置文件

 uname -a

Linux yangyang 3.8.0-32-generic #47~precise1-Ubuntu SMP Wed Oct 2 16:19:35 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

安装包使用的是:gerrit-2.8-rc3.war

目录安装在:

/home/gerrit2/gerrit_application_directory

增加了了gerrit用户

数据库使用了h2,mysql的不会弄

gerrit.config:

[gerrit]
	basePath = git
	canonicalWebUrl = http://127.0.0.1:8081/
[database]
	type = h2
	hostname = localhost
	database = reviewdb
	username = gerrit2
[auth]
	type = HTTP
[sendemail]
	smtpServer = smtp.163.com
	smtpServerPort = 25
	smtpEncryption = TLS
	smtpUser = xbl1986
[container]
	user = gerrit2
	javaHome = /usr/lib/jvm/java-6-openjdk-amd64/jre
[sshd]
	listenAddress = *:29418
[httpd]
	listenUrl = http://*:8081/
[cache]
	directory = cache

然后apache2的配置:

/etc/apache2/sites-available/default

<VirtualHost *:8090>
	ServerName localhost

	ProxyRequests Off
	ProxyVia Off
	ProxyPreserveHost On

	<Proxy *:8090>
		Order deny,allow
		Allow from all
	</Proxy>

	<Location "/login/">
		AuthType Basic
		AuthName "Gerrit Code Review"
		AuthBasicProvider file
		AuthUserFile /home/gerrit2/gerrit_application_directory/etc/passwords
		Require valid-user
	</Location>

	ProxyPass / http://127.0.0.1:8081/
	ProxyPassReverse / http://127.0.0.1:8081/
	SetEnv force-proxy-request-1.0.1
	SetEnv proxy-nokeepalive 1
</VirtualHost>

ports.conf:

 NameVirtualHost *:80
 NameVirtualHost *:8090
 Listen 80
 Listen 8090

这样的结果是访问本地的127.0.0.1的80端口是用的apache2的 It Works!页面

访问8090端口是gerrit的页面~我尝试访问8081端口也能进去……另外的My Reviews界面~~这个不知道为什么

关键在于apache配置的不是8081而是8090

我配置成8081的时候一直提示出错

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 '/':

这种的错误,不知道怎么解决。

不过现在总算是解决了。

你可能感兴趣的:(Ubuntu 建立 Gerrit服务器 配置文件)