Nginx connect() to unix:/var/run/fcgiwrap.socket failed

By | November 30, 2017
Questions:

I’m trying to install Gitweb on my Nginx server. Everything seems to be configured correctly, but I seem to be getting the following error in the gitweb.log:

`2015/06/08 08:42:05 [crit] 29135#0: *5 connect() to unix:/var/run/fcgiwrap.socket failed (13: Permission denied) while connecting to upstream, client: 83.36.85.6, server: git.mydomain.co.uk, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/fcgiwrap.socket:", host: "git.mydomain.co.uk"`

I’ve checked the owner/permissions and all seems to be fine.

srwxr-xr-x 1 www-data www-data 0 Jun 8 08:44 /var/run/fcgiwrap.socket

The output of ps aux | grep nginx is:

root     30283  0.0  0.0  90552  1296 ?        Ss   08:59   0:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
forge    30284  0.0  0.0  90884  1924 ?        S    08:59   0:00 nginx: worker process                           
forge    30285  0.0  0.1  90884  2408 ?        S    08:59   0:00 nginx: worker process                           
root     30528  0.0  0.0  11980   928 pts/0    R+   09:03   0:00 grep --color=auto nginx

Any ideas what the problem could be?

Answers:

The socket has to be readable and writable by both client and server. Under the assumption that the server is running as www-data and the client is running as forge with group forge, the following steps should fix the issue.

Change the group ownership of the socket to the group of user forge.

chgrp forge /var/run/fcgiwrap.socket

Change the group permission to allow write for group forge.

chmod g+w /var/run/fcgiwrap.socket

The socket will now be readable and writable by both server and client.

Leave a Reply

Your email address will not be published. Required fields are marked *