NGINX – (13: Permission denied) while connecting to upstream node.js server

While experimenting with simple node.js server on CentOS 7 and nginx upstream directive I run into some issues. I was able to access the node.js server running on port 8080 but when trying to access it via nginx I was getting error msg: (13: Permission denied) while connecting to upstream and 502 Bad Gateway error in the browser.

2016/01/10 14:34:55 [crit] 16705#0: *2 connect() to [::1]:8080 failed (13: Permission denied) while connecting to upstream, client: 172.31.123.123, server: www.mynode.local, request: "GET / HTTP/1.0", upstream: "http://[::1]:8080/", host: "www.mynode.local"

It turned out to be SELinux issue. I checked for errors in the SELinux logs:
cat /var/log/audit/audit.log | grep nginx | grep denied
where I found few clues:
type=AVC msg=audit(1452436495.252:181): avc: denied { name_connect } for pid=16705 comm="nginx" dest=8080 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:http_cache_port_t:s0 tclass=tcp_socket

And found that running the following commands fixed my issue:
cat /var/log/audit/audit.log | grep nginx | grep denied | audit2allow -M mynginx
semodule -i mynginx.pp

After that everything was working as expected.

php5-fpm – sock failed (13: Permission denied) while connecting to upstream error

I was recently making some changes in my php5-fpm config and after service restart I started getting this error:
*812 connect() to unix:/var/run/php5-fpm/website.sock failed (13: Permission denied) while connecting to upstream, client: 1.2.3.4, server: website.com, request: "GET /feed/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm/website.sock:", host: "website.com"

Going through the logs I narrowed the error down to permissions on the website.sock file.

the fix was to add this section to my /etc/php5/fpm/pool.d/www.conf file:

listen.owner = www-data
listen.group = www-data
listen.mode = 0660

Make sure that www-data is actually the user the nginx worker is running as. For debian it’s www-data by default.

accessing share folder on windows 7 from XP

..you need to tell Windows 7 that you want to use the machine as a file server and that it should allocate resources accordingly.
Set the following registry key to ‘1′:
HKLMSYSTEMCurrentControlSetControlSession ManagerMemory ManagementLargeSystemCache

and set the following registry key to ‘3′:
HKLMSYSTEMCurrentControlSetServicesLanmanServerParametersSize

After changing the two registry settings, I simply restarted the “Server” service in Windows 7 and now the sharing is working fine.