首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法使用Apache和Tomcat在端口80上运行GitLab

无法使用Apache和Tomcat在端口80上运行GitLab
EN

Server Fault用户
提问于 2015-04-29 19:44:21
回答 1查看 4.3K关注 0票数 1

我使用Omnibus安装程序安装了GitLab。目前,它正在使用运行在端口81上的Nginx (与GitLab捆绑在一起)正确工作。我从端口80更改为端口81,因为我在端口80上运行Apache。我还在端口8080上安装和运行Tomcat,所以我将Unicorn端口更改为8081。所有这些都是正确的。下面是我更改的设置:

/etc/gitlab/gitlab.rb

代码语言:javascript
复制
# https://gitlab.com/gitlab-org/omnibus-gitlab/blob/629def0a7a26e7c2326566f0758d4a27857b52a3/README.md#configuring-the-external-url-for-gitlab
external_url 'http://mysite.example.net:81'

#https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#tcp-ports-for-gitlab-services-are-already-taken
unicorn['port'] = 8081

#https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#storing-git-data-in-an-alternative-directory
git_data_dir "/mnt/tank/gitlab"

/var/opt/gitlab/gitlab-rails/etc/gitlab.yml

代码语言:javascript
复制
production: &base
  #
  # 1. GitLab app settings
  # ==========================

  ## GitLab settings
  gitlab:
    ## Web server settings (note: host is the FQDN, do not include http://)
    host: mysite.example.net
    port: 81
    https: false

不幸的是,我需要GitLab在端口80上运行。我尝试过几个Apache虚拟主机配置。我唯一的成功是我可以输入http://mysite.example.com/gitlab并得到一个404错误,但是我看到这个URL更改为http://mysite.example.com/users/sign_in。重定向导致gitlab被删除,但如果我将其放回以获取http://mysite.example.com/gitlab/users/sign_in URL,我可以看到GitLab登录页面,尽管所有这些图像都没有正确。我用来实现这些结果的配置如下:

/etc/gitlab/gitlab.rb

代码语言:javascript
复制
    # https://gitlab.com/gitlab-org/omnibus-gitlab/blob/629def0a7a26e7c2326566f0758d4a27857b52a3/README.md#configuring-the-external-url-for-gitlab
    external_url 'http://mysite.example.com'

#https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#tcp-ports-for-gitlab-services-are-already-taken
    unicorn['port'] = 8081

    #https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#storing-git-data-in-an-alternative-directory
    git_data_dir "/mnt/tank/gitlab"

    #https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/nginx.md#using-a-non-bundled-web-server
    nginx['enable'] = false
    web_server['external_users'] = ['www-data']

/etc/apache2/apache2.conf

代码语言:javascript
复制
ServerName mysite.example.com

ProxyRequests Off
<Proxy *>
        Order Allow,Deny
        Allow from all
</Proxy>

# transmission
ProxyPass /transmission http://localhost:9091/transmission
ProxyPassReverse /transmission http://localhost:9091/transmission

# gitlab
ProxyPass /gitlab http://localhost:8081
ProxyPassReverse /gitlab http://localhost:8081

/var/opt/gitlab/gitlab-rails/etc/gitlab.yml

代码语言:javascript
复制
production: &base
  #
  # 1. GitLab app settings
  # ==========================

  ## GitLab settings
  gitlab:
    ## Web server settings (note: host is the FQDN, do not include http://)
    host: mysite.example.com
    port: 80
    https: false
EN

回答 1

Server Fault用户

回答已采纳

发布于 2017-07-04 11:39:07

我也遇到过类似的问题,希望与apache一起建立gitlab,但我不知道我的解决方案是否适用于您的情况:

我为子域'gitlab.example.com‘设置了dns记录,以指向域'example.com',并为子域添加了一个虚拟主机。这允许我让代理工作为'/‘而不是'/gitlab’。以下是我的配置文件:

/etc/gitlab/gitlab.rb:

代码语言:javascript
复制
external_url 'http://localhost:81'

虚拟主机(in /etc/apache2/apache2.conf)

代码语言:javascript
复制
<VirtualHost *:80>
    ServerName gitlab.example.com

    ProxyPass /  http://localhost:81
    ProxyPassReverse / http://localhost:81
</VirtualHost>

这样我就可以通过'http://gitlab.example.com‘使用gitlab

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

https://serverfault.com/questions/686566

复制
相关文章

相似问题

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