如何使用非捆绑式Web服务器设置Gitlab-omnibus?


11

安装

  1. gitlab通过debian 7(版本7.8.1-omnibus-1_amd64.deb)上的omnibus软件包安装了该软件包;
  2. 使用非捆绑式Web服务器中所述更改设置
  3. 运行reconfigure命令:(sudo gitlab-ctl reconfigure完成,没有错误)。

Nginx的

nginx除了软件包可能使用以下/etc/gitlab/gitlab.rb文件创建的内容外,我没有为此gitlab配置:

external_url 'http://git.mydomain.fr'
web_server['external_users'] = ['www-data']
nginx['enable'] = false
ci_nginx['enable'] = false

日志

/var/log/nginx/gitlab_error.log

2015/02/28 14:29:16 [alert] 4137#0: *14738 768 worker_connections are not enough while connecting to upstream, client: x.x.128.194, server: git.mydomain.fr, request: "GET / HTTP/1.0", upstream
: "http://x.x.128.194:80/", host: "git.mydomain.fr"

/var/log/nginx/gitlab_access.log

在acces.log中,我收到了数百个请求/

x.x.128.194 - - [28/Feb/2015:14:29:16 +0100] "GET / HTTP/1.0" 500 186 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:37.0) Gecko/20100101 Firefox/37.0"
x.x.128.194 - - [28/Feb/2015:14:29:16 +0100] "GET / HTTP/1.0" 500 186 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:37.0) Gecko/20100101 Firefox/37.0"
x.x.128.194 - - [28/Feb/2015:14:29:16 +0100] "GET / HTTP/1.0" 500 186 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:37.0) Gecko/20100101 Firefox/37.0"x.x.128.194 - - [28/Feb/2015:14:29:16 +0100] "GET / HTTP/1.0" 500 186 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:37.0) Gecko/20100101 Firefox/37.0"
x.x.128.194 - - [28/Feb/2015:14:29:16 +0100] "GET / HTTP/1.0" 500 186 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:37.0) Gecko/20100101 Firefox/37.0"

尝试使用本地links2或外部联系服务时遇到错误502 Bad Gateway

  • 我需要创建一个自定义nginx的配置吗?

Answers:


9

继续探索,我找到/var/opt/gitlab/目录并解决此问题:

sudo ln -s /var/opt/gitlab/nginx/conf/gitlab-http.conf /etc/nginx/sites-available/
sudo ln -s /etc/nginx/sites-{available,enabled}/gitlab-http.conf
sudo service nginx reload

我将标志着以此为̶a̶n̶s̶w̶e̶r̶.̶它的工作原理,据我所知,̶并没有更好的做法/解决方案让即使在登录时404错误。这是我的错误吗?
GCon 2015年

1
是的,这是我的错误。作品!
GCon 2015年

1
请注意,这将不再完全起作用,因为您会收到unknown log format "gitlab_access" in /etc/nginx/sites-enabled/gitlab-http.conf:52错误消息。
00500005 '16

以下内容解决了日志格式问题,sudo ln -s /var/opt/gitlab/nginx/conf/nginx.conf /etc/nginx/sites-available/以及sudo ln -s /etc/nginx/sites-{available,enabled}/nginx.conf
solidgumby 2016年

2

至于gitlab 8,我们无法再符号链接到默认的gitlab-http.conf,因为设置时将不会安装捆绑包网络服务器nginx['enable'] = false

只需从GitLab食谱存储库下载正确的Web服务器配置,然后更改YOUR_SERVER_FQDN您的首选域名即可。

有关如何使用非捆绑式Web服务器安装gitlab的详细说明,请参见此处


1

为了确保用户可访问,应将您的Nginx用户(通常是www-data或nginx)添加到gitlab-www组:

sudo usermod -aG gitlab-www nginx

要么

sudo usermod -aG gitlab-www www-data

1

如果您对gitlab-http.conf进行符号链接,然后得到:

/etc/nginx/sites-enabled/gitlab-http.conf中的未知日志格式“ gitlab_access”

只需将log_format指令从添加/var/opt/gitlab/nginx/conf/nginx.conf到全局nginx配置中:

http {
  ...
  log_format gitlab_access '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"';
  log_format gitlab_ci_access '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"';
  log_format gitlab_mattermost_access '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"';
  ...
}
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.