gerrit 配置 apache2 反向代理(转载)

Apache 2 Configuration

To run Gerrit behind an Apache server using mod_proxy, enable the necessary Apache2 modules:

  a2enmod proxy_http
  a2enmod ssl          ; # optional, needed for HTTPS / SSL

Configure an Apache VirtualHost to proxy to the Gerrit daemon, setting the ProxyPass line to use the http:// URL configured above. Ensure the path of ProxyPass and httpd.listenUrl match, or links will redirect to incorrect locations.

        <VirtualHost *>
          ServerName review.example.com

          ProxyRequests Off
          ProxyVia Off
          ProxyPreserveHost On

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

          AllowEncodedSlashes On
          ProxyPass /r/ http://127.0.0.1:8081/r/ nocanon
        </VirtualHost>

The two options AllowEncodedSlashes On and ProxyPass .. nocanon are required since Gerrit 2.6.

SSL

To enable Apache to perform the SSL processing, use proxy-https:// in httpd.listenUrl within Gerrit’s configuration file, and enable the SSL engine in the Apache VirtualHost block:

        <VirtualHost *:443>
          SSLEngine on
          SSLCertificateFile    conf/server.crt
          SSLCertificateKeyFile conf/server.key

          ... same as above ...
        </VirtualHost>

See the Apache mod_ssl documentation for more details on how to configure SSL within the server, like controlling how strong of an encryption algorithm is required.

Troubleshooting

If you are encountering Page Not Found errors when opening the change screen, your Apache proxy is very likely decoding the passed URL. Make sure to either useAllowEncodedSlashes On together with ProxyPass .. nodecode or alternatively a mod_rewrite configuration with AllowEncodedSlashes NoDecode set.

 

From:http://gerrit-documentation.googlecode.com/svn/Documentation/2.6/config-reverseproxy.html

posted @ 2014-03-11 17:31  泉水叮~咚  阅读(2209)  评论(0编辑  收藏  举报