gerrit 多端口

服务器的apache上配置了redmine和gerrit,redmine使用默认端口80,gerrit按照网上配置httpd.conf,

  1. <VirtualHost *>  
  2.   ServerName localhost  
  3.   ProxyRequests Off  
  4.   ProxyVia Off  
  5.   ProxyPreserveHost On  
  6.   
  7.   <Proxy *>  
  8.         Order deny,allow  
  9.         Allow from all  
  10.   </Proxy>  
  11.    
  12.   <Location /login/>  
  13.      AuthType Basic  
  14.      AuthName "Gerrit Code Review"  
  15.      AuthBasicProvider file  
  16.      AuthUserFile /home/xx/gerrt_sites/etc/passwords  
  17.      Require valid-user  
  18.   </Location>  
  19.   
  20.   ProxyPass / http://127.0.0.1:8088/  
  21. </VirtualHost>
这样配置的结果就是通过127.0.0.1打开gerrit,但是不能打开127.0.0.1/redmine。网上说可以通过在apache中配置多站点来解决,但是偶配置了多次都不成功,改用多端口解决。

方法:

1.首先在/etc/apache2/ports.conf中添加

NameVirtualHost *:8090
Listen 8090

2.配置/etc/apache2/httpd.conf:

ServerName localhost
<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/xx/gerrit_sites/etc/passwords  
      Require valid-user
    </Location>       
      
    ProxyPass / http://127.0.0.1:8088/
    ProxyPassReverse / http://127.0.0.1:8088/
    SetEnv force-proxy-request-1.0.1   
    SetEnv proxy-nokeepalive 1   
</VirtualHost>


3.ProxyPass / http://127.0.0.1:8088/,这里的配置必须和/home/xx/gerrt_sites/etc/gerrit.config文件里面的

[httpd]
    listenUrl = http://*:8088/ 相一致。


打开:127.0.0.1:8090,成功,127.0.0.1/redmine也可以打开。

之前一直用http://127.0.0.1:8088/来打开,结果总报错:

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

虽然可以使用了,但是感觉用多端口比较麻烦,总忘记。再看看多站点怎么配置吧!

 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值