[root@liantu_61 home]# cat /etc/redhat-release CentOS release 6.7 (Final)
错误日志:
2016/01/29 17:36:20 [crit] 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信息:
[root@xxx_61 home]# ps aux|grep nginx root 27280 0.0 0.0 17668 944 ? Ss 17:35 0:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf www 27281 0.0 0.0 18096 1652 ? S 17:35 0:00 nginx: worker process www 27282 0.0 0.0 18404 2192 ? S 17:35 0:00 nginx: worker process www 27283 0.0 0.0 18096 1652 ? S 17:35 0:00 nginx: worker process www 27284 0.0 0.0 18096 1636 ? S 17:35 0:00 nginx: worker process root 27531 0.0 0.0 103304 936 pts/0 S+ 17:39 0:00 grep nginx
解决办法:
nginx换用git git正常.说明权限问题.但是服务器必须用www用户运行nginx.
解决思路:将nginx运行用户www加入git组
然后赋予git用户组可实行权限
usermod -a -G git www [root@xxx_61 home]# 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/