centos下解決nginx 無法串連gitlab socket
[root@liantu_61home]
#cat/etc/redhat-release
CentOSrelease6.7(Final)
錯誤記錄檔:
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資訊:
[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
解決辦法:
nginx換用git git正常.說明許可權問題.但是伺服器必須用www使用者運行nginx.
解決思路:將nginx運行使用者www加入git組
然後賦予git使用者組可實行許可權
usermod
-a-Ggitwww
[root@xxx_61home]
#idwww
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/