win10安装gerrit+Apache

2018-11-02  本文已影响61人  在Azkaban写代码

1、前期准备

2、Apache安装

 > httpd.exe -k install -n apache

3、安装gerrit

> java -jar gerrit-2.15.6.war init -d  D:/TestGerrit/gerrit

4、重点,配置Apache中的httpd.conf文件

mod_access_compat
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule rewrite_module modules/mod_rewrite.so
<VirtualHost *:80>
    ServerName v3server
    ProxyRequests Off
    ProxyVia Off
    ProxyPreserveHost On

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

     <Location "/login/">
        AuthType Basic
        AuthName "Gerrit Code Review"
        Require valid-user
        AuthBasicProvider file
        AuthUserFile H:/git/htpasswd/.passwd
    </Location>
    ProxyPass / http://IP地址:8080/
    ProxyPassReverse / http://IP地址:8080/
</VirtualHost> 

5、重点,配置gerrit中的gerrit.conf文件

[gerrit]
    basePath = git
    serverId = 6e54893d-1309-4859-972b-3a9191e2ece1
    canonicalWebUrl = http://IP地址:8080/
[database]
    type = H2
    database = H:\\git\\gerrit\\db\\ReviewDB
[noteDb "changes"]
    disableReviewDb = true
    primaryStorage = note db
    read = true
    sequence = true
    write = true
[index]
    type = LUCENE
[auth]
    type = http
[receive]
    enableSignedPush = false
[sendemail]
    smtpServer = smtp.example.com
    smtpUser = example
    smtpPass = example
    from = example
[container]
    user = TestGit
    javaHome = D:\\java\\jre
[sshd]
    listenAddress = *:29418
[httpd]
    listenUrl = http://IP地址:8080/
[cache]
    directory = cache

1、修改canonicalWebUrl,和Apache保持一致
2、basePath = git ,git为gerrit根目录的文件夹
3、修改[auth]中type = http
4、修改listenUrl
5、sendemail参数配置自己的邮箱,如果没有,先不用配置

6、运行

1、先运行gerrit,在gerrit根目录中命令行运行,提示Ready,才能成功:

> java -jar bin\gerrit.war daemon --console-log

2、运行Apache,在浏览器查看是否成功

上一篇 下一篇

猜你喜欢

热点阅读