如何正确configurationApaches mod_proxy为郊区下的GitLab与其他郊区的组合

我有一台服务器,我想在其他服务旁边运行GitLab。 search了一段时间后,我发现我需要做一些mod_proxy技巧来让Apache2转发请求到GitLab。 但是现在,当我尝试访问服务器上不是/ git下的GitLab URL的任何URL时,我只是得到一个错误。 我什至不能访问apaches标准的index.html页面,我明显应该。 服务器在Ubuntu 14.04 LTS下运行。 gitlab的configuration文件是:

#This configuration has been tested on GitLab 6.0.0 and GitLab 6.0.1 #Note this config assumes unicorn is listening on default port 8080. #Module dependencies # mod_rewrite # mod_proxy # mod_proxy_http <VirtualHost *:80> ServerName lmmweb ServerSignature Off ProxyPreserveHost On # Ensure that encoded slashes are not decoded but left in their encoded state. # http://doc.gitlab.com/ce/api/projects.html#get-single-project AllowEncodedSlashes NoDecode <Location /git> # New authorization commands for apache 2.4 and up # http://httpd.apache.org/docs/2.4/upgrading.html#access Require all granted ProxyPassReverse http://127.0.0.1:8080 </Location> #apache equivalent of nginx try files # http://serverfault.com/questions/290784/what-is-apaches-equivalent-of-nginxs-try-files # http://stackoverflow.com/questions/10954516/apache2-proxypass-for-rails-app-gitlab RewriteEngine on RewriteCond %{DOCUMENT_ROOT}/git/%{REQUEST_FILENAME} !-f RewriteRule /git/.* http: // 127.0.0.1 :8080%{REQUEST_URI} [P,QSA] # needed for downloading attachments DocumentRoot /home/git/gitlab/public #Set up apache error documents, if back end goes down (ie 503 error) then a maintenance/deploy page is thrown up. ErrorDocument 404 /404.html ErrorDocument 422 /422.html ErrorDocument 500 /500.html ErrorDocument 503 /deploy.html LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" common_forwarded ErrorLog /var/log/apache2/gitlab/error.log </VirtualHost> 

我很确定RewriteRules里面一定有一个失败,但是找不到它。 我在RewriteRule中包含了双重空格,因为缺乏声誉,我得到了一些错误。

最好的问候和感谢您的帮助。

我find了解决scheme:

问题是覆盖所有其他定义的虚拟主机。 有必要让我的设置让这个gitlab实例在不同的端口下运行,然后从主configuration代理到这个gitlab实例。

所以我的虚拟主机现在是<VirtualHost:8081>并在Listen 8081之前。 在我想要configuration郊区的configuration文件中,我添加了:

 <Location /git> ProxyPass http://mydomain:8081/git ProxyPassReverse http://mydomain:8081/git </Location>