gitlab 访问502问题

gitlab 访问502问题

出现这种一般有两种情况:

1、是端口被占用,去/etc/gitlab/gitlab.rb 检查 external_url的端口有没有被占用,检查unicorn[‘port’] 有没有被占用;

2、检查nginx的错误日志,如出现: 30339#0: *49 connect() to unix:/var/opt/gitlab/gitlab-workhorse/socket failed (13: Permission denied) while connecting to upstream, client: 220.160.64.12, server: git.xxx.com, request: “GET /favicon.ico HTTP/1.1”, upstream: “http://unix:/var/opt/gitlab/gitlab-workhorse/socket:/favicon.ico”, host: “git.xxx.com”, referrer: “https://git.xxx.com/”,则是权限问题,

通过nginx日志可以看出,nginx没有访问gitlab的socket权限,修改方式有多种,我的机器上nginx的执行用户是nginx,而socket文件夹为

drwxr-x— 2 git gitlab-www 4096 11月 3 15:57 sockets

文件赋权限
# chmod -R o+x /var/opt/gitlab/gitlab-rails/sockets
or
# chmod 755 /var/opt/gitlab/gitlab-rails/sockets

将nginx用户加入gitlab-www组
# usermod -a -G gitlab-www nginx

修改配置
# vim /etc/gitlab/gitlab.rb
web_server[‘external_users’] = [‘nginx’]
# web_server[‘username’] = ‘gitlab-www’
# web_server[‘group’] = ‘gitlab-www’

 

最后,gitlab-ctl reconfigure

gitlab-ctl restart

问题解决!!!

Comments are closed.