<code>[root@liantu_61 home]</code><code># cat /etc/redhat-release </code>
<code>CentOS release 6.7 (Final)</code>
錯誤日志:
<code>2016</code><code>/01/29</code> <code>17:36:20 [crit] 27282</code><code>#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/"</code>
nginx資訊:
<code>[root@xxx_61 home]</code><code># ps aux|grep nginx</code>
<code>root 27280 0.0 0.0 17668 944 ? Ss 17:35 0:00 nginx: master process </code><code>/usr/local/nginx/sbin/nginx</code> <code>-c </code><code>/usr/local/nginx/conf/nginx</code><code>.conf</code>
<code>www 27281 0.0 0.0 18096 1652 ? S 17:35 0:00 nginx: worker process </code>
<code>www 27282 0.0 0.0 18404 2192 ? S 17:35 0:00 nginx: worker process </code>
<code>www 27283 0.0 0.0 18096 1652 ? S 17:35 0:00 nginx: worker process </code>
<code>www 27284 0.0 0.0 18096 1636 ? S 17:35 0:00 nginx: worker process </code>
<code>root 27531 0.0 0.0 103304 936 pts</code><code>/0</code> <code>S+ 17:39 0:00 </code><code>grep</code> <code>nginx</code>
解決辦法:
nginx換用git git正常.說明權限問題.但是伺服器必須用www使用者運作nginx.
解決思路:将nginx運作使用者www加入git組
然後賦予git使用者組可實行權限
<code>usermod</code> <code>-a -G git www</code>
<code>[root@xxx_61 home]</code><code># id www</code>
<code>uid=501(www) gid=501(www) </code><code>groups</code><code>=501(www),503(git)</code>
<code>chmod</code> <code>g+rx </code><code>/home/git/</code>
本文轉自 yawei555 51CTO部落格,原文連結:http://blog.51cto.com/huwei555/1739923,如需轉載請自行聯系原作者