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

這種的錯誤,不知道怎麼解決。

不過現在總算是解決了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章