centos下解决nginx 无法连接gitlab socket
1
2
# cat /etc/redhat-release
CentOS release 6.7 (Final)
错误日志:
1
2016/01/29 17:36:20 27282#0: *1 connect() to unix:/home/git/gitlab/tmp/sockets/gitlab.socket failed (13: Permission denied) while connecting to upstream, client: 192.168.xxx.xxx, server: test61.com, request: "GET /5755/my/notes?target_id=918a696a0e2340c2ee95402fa59187926edaae0c&target_type=commit HTTP/1.1", upstream: "http://unix:/home/git/gitlab/tmp/sockets/gitlab.socket:/502.html", host: "test61.com", referrer: "http://test61.com/"
nginx信息:
1
2
3
4
5
6
7
# ps aux|grep nginx
root 272800.00.017668 944 ? Ss 17:35 0:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
www 272810.00.0180961652 ? S 17:35 0:00 nginx: worker process
www 272820.00.0184042192 ? S 17:35 0:00 nginx: worker process
www 272830.00.0180961652 ? S 17:35 0:00 nginx: worker process
www 272840.00.0180961636 ? S 17:35 0:00 nginx: worker process
root 275310.00.0 103304 936 pts/0 S+ 17:39 0:00 grep nginx
解决办法:
nginx换用git git正常.说明权限问题.但是服务器必须用www用户运行nginx.
解决思路:将nginx运行用户www加入git组
然后赋予git用户组可实行权限
1
2
3
4
usermod -a -G git www
# id www
uid=501(www) gid=501(www) groups=501(www),503(git)
chmod g+rx /home/git/
参考信息:http://axilleas.me/en/blog/2013/selinux-policy-for-nginx-and-gitlab-unix-socket-in-fedora-19/
页:
[1]