首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Gitlab 8.0.3与Apache2 / Nginx

Gitlab 8.0.3与Apache2 / Nginx
EN

Server Fault用户
提问于 2015-11-10 15:10:58
回答 1查看 581关注 0票数 1

背景

Ubuntu 15.10

Apache/2.4.10 (Ubuntu)

所有模块依赖项都已启用:

  • mod_rewrite
  • mod_proxy
  • mod_proxy_http

GitLab社区版8.0.3

/opt/gitlab/embedded/service/gitlab-rails/public : GitLab docroot

我以这种方式安装GitLab:https://about.gitlab.com/downloads/#ubuntu1404

问题

在我的服务器上,我有一个用apache2运行的网站(例如-site.com)。

我使用捆绑的nginx运行GitLab (例如-gitlab.com)

我有一个服务器,一个IP和多个FQDN。

就像这样,我所有的域名都指向GitLab。

因此,eximple-gitlab.com指向GitLab,但则指向GitLab,所有其他的FQDN也是。

解决

方法

我想我必须(而且我也试过):

  • 禁用捆绑的nginx并使用apache2配置gitlab (对我来说很难)
  • 将捆绑的nginx配置为apache2的反向代理(对我来说很难)

MAJ :实际上,问题是Apache和捆绑-nginx运行在同一个IP上,端口相同(80)。我不想在端口81或其他地方运行网站,只有端口80。

我更喜欢在我的所有apache2网站上使用apache2,我不介意gitlab使用apache2或捆绑的nginx,我只想为我的每个网站使用所有的FQDN,而不是把所有的FQDN重定向到gitlab。

Understanding

我不明白综合总线、rails或反向代理是如何工作的。

我试过在/etc/gitlab/gitlab.rb中禁用捆绑的nginx

代码语言:javascript
复制
nginx['enable'] = false
# For GitLab CI, use the following:
ci_nginx['enable'] = false

www-data添加到gitlab-www组并修改:

代码语言:javascript
复制
web_server['external_users'] = ['www-data']

在apache2中添加一个修改后的apache2--我从https://gitlab.com/gitlab-org/gitlab-recipes/blob/master/web-server/apache/gitlab-apache24.conf获取它

代码语言:javascript
复制
    <VirtualHost *:80>
    ServerName exemple-gitlab.com
    ServerSignature Off
    ProxyPreserveHost On

    AllowEncodedSlashes NoDecode

    <Location />
    Require all granted

    #Allow forwarding to gitlab-git-http-server
    ProxyPassReverse http://127.0.0.1:8181
    #Allow forwarding to GitLab Rails app (Unicorn)
    ProxyPassReverse http://127.0.0.1:8080
    ProxyPassReverse http://exemple-gitlab.com/
    </Location>

    #apache equivalent of nginx try files
    RewriteEngine on
    #Forward these requests to gitlab-git-http-server
    RewriteCond %{REQUEST_URI} ^/[\w\.-]+/[\w\.-]+/repository/archive.* [OR]
    RewriteCond %{REQUEST_URI} ^/api/v3/projects/.*/repository/archive.* [OR]
    RewriteCond %{REQUEST_URI} ^/[\w\.-]+/[\w\.-]+/(info/refs|git-upload-pack|git-receive-pack)$
    RewriteRule .* http://127.0.0.1:8181%{REQUEST_URI} [P,QSA]

    #Forward any other requests to GitLab Rails app (Unicorn)
    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f [OR]
    RewriteCond %{REQUEST_URI} ^/uploads
    RewriteRule .* http://127.0.0.1:8080%{REQUEST_URI} [P,QSA,NE]

    # needed for downloading attachments
    /opt/gitlab/embedded/service/gitlab-rails/public

    #Set up apache error documents, if back end goes down (i.e. 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

    # /var/log/apache2.
    LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" common_forwarded
    ErrorLog  /var/log/apache2/logs/gitlab.example.com_error.log
    CustomLog /var/log/apache2/logs/gitlab.example.com_forwarded.log common_forwarded
    CustomLog /var/log/apache2/logs/gitlab.example.com_access.log combined env=!dontlog
    CustomLog /var/log/apache2/logs/gitlab.example.com.log combined

  </VirtualHost>

但是这个文件对我的apache2产生了影响:

代码语言:javascript
复制
~# systemctl status apache2.service
● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2)
   Active: failed (Result: exit-code) since mar. 2015-11-10 15:41:08 CET; 1min 9s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 18315 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
  Process: 18342 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)

nov. 10 15:41:08 vpsxxx.ovh.net apache2[18342]: * The apache2 configtest failed.
nov. 10 15:41:08 vpsxxx.ovh.net apache2[18342]: Output of config test was:
nov. 10 15:41:08 vpsxxx.ovh.net apache2[18342]: (2)No such file or directory: AH02291: Cannot access di...f:10
nov. 10 15:41:08 vpsxxx.ovh.net apache2[18342]: AH00014: Configuration check failed
nov. 10 15:41:08 vpsxxx.ovh.net apache2[18342]: Action 'configtest' failed.
nov. 10 15:41:08 vpsxxx.ovh.net apache2[18342]: The Apache error log may have more information.
nov. 10 15:41:08 vpsxxx.ovh.net systemd[1]: apache2.service: Control process exited, code=exited status=1
nov. 10 15:41:08 vpsxxx.ovh.net systemd[1]: Failed to start LSB: Apache2 web server.
nov. 10 15:41:08 vpsxxx.ovh.net systemd[1]: apache2.service: Unit entered failed state.
nov. 10 15:41:08 vpsxxx.ovh.net systemd[1]: apache2.service: Failed with result 'exit-code'.
Hint: Some lines were ellipsized, use -l to show in full.
EN

回答 1

Server Fault用户

发布于 2015-11-10 15:25:14

我通过注释每一行(damm日志是无用的)找到了apache2崩溃的原因。

我只需要创建/var/log/apache2/logs

代码语言:javascript
复制
 ErrorLog  /var/log/apache2/logs/gitlab.example.com_error.log
  CustomLog /var/log/apache2/logs/gitlab.example.com_forwarded.log common_forwarded
  CustomLog /var/log/apache2/logs/gitlab.example.com_access.log combined env=!dontlog
  CustomLog /var/log/apache2/logs/gitlab.example.com.log combined

apache2崩溃是因为文件夹/目录丢失了.

现在,gitlab正在开发is域,我的drupal也是这样的:

  • gitlab.com:80
  • drupal.com:80

如我所愿:)

票数 0
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/735270

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档