我使用 Omnibus 安装程序安装了 GitLab。它目前使用在端口 81 上运行的 Nginx(与 GitLab 捆绑在一起)正常工作。我从端口 80 更改为端口 81,因为我在端口 80 上运行了 Apache。我还在端口 8080 上安装并运行了 Tomcat,所以我改变了独角兽端口到 8081。所有这些都正常工作。以下是我更改的设置:
/etc/gitlab/gitlab.rb
# 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
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 虚拟主机配置。我唯一的成功是我可以键入 URLhttp://mysite.example.com/gitlab
并收到 404 错误,但我看到 URL 更改为http://mysite.example.com/users/sign_in
. 重定向导致将gitlab
其删除,但如果我将其放回以获取 URL,http://mysite.example.com/gitlab/users/sign_in
我可以看到 GitLab 登录页面,尽管它全部被顶起,因为没有图像是正确的。我用来实现这些结果的配置如下:
/etc/gitlab/gitlab.rb
# 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
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
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
我有一个类似的问题,想用 apache 设置 gitlab,但我不知道我的解决方案是否适用于你的情况:
我将子域“gitlab.example.com”的 dns 记录设置为指向域“example.com”,并为子域添加了一个虚拟主机。这使我可以使用“/”而不是“/gitlab”的代理工作。这是我的配置文件:
/etc/gitlab/gitlab.rb:
虚拟主机(在 /etc/apache2/apache2.conf 中)
这样我可以通过' http://gitlab.example.com '使用gitlab