Nginx cannot connect to gitlab socket in centos
[root@liantu_61home]#cat/etc/redhat-releaseCentOSrelease6.7(Final)
Error Log:
2016 /01/29 17:36:20[crit]27282 #0:*1connect()tounix:/home/git/gitlab/tmp/sockets/gitlab.socketfailed(13:Permissiondenied)whileconnectingtoupstream,client:192.168.xxx.xxx,server:test61.com,request:"GET/5755/my/notes?target_id=918a696a0e2340c2ee95402fa59187926edaae0c&target_type=commitHTTP/1.1",upstream:"http://unix:/home/git/gitlab/tmp/sockets/gitlab.socket:/502.html",host:"test61.com",referrer:"http://test61.com/"
Nginx information:
[root@xxx_61home] #psaux|grepnginx root272800.00.017668944?Ss17:350:00nginx:masterprocess /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx .conf www272810.00.0180961652?S17:350:00nginx:workerprocess www272820.00.0184042192?S17:350:00nginx:workerprocess www272830.00.0180961652?S17:350:00nginx:workerprocess www272840.00.0180961636?S17:350:00nginx:workerprocess root275310.00.0103304936pts /0 S+17:390:00 grep nginx
Solution:
Nginx is normal with git. Permission issues are described. However, the server must use www users to run nginx.
Solution: add the nginx running user www to the git Group
Then grant the git user group permissions.
usermod -a-Ggitwww [root@xxx_61home] #idwww uid=501(www)gid=501(www) groups =501(www),503(git) chmod g+rx /home/git/
Information: http://axilleas.me/en/blog/2013/selinux-policy-for-nginx-and-gitlab-unix-socket-in-fedora-19/