in Server

Nodejs Nginx error: failed (13: Permission denied)

1 Star2 Stars3 Stars4 Stars5 Stars (10 votes, average: 4.70 out of 5)
Loading...

Using Nodejs Nginx you can get this error: failed (13: Permission denied) while connecting to upstream error can display when trying to run a Nodejs application on Nginx server on some ports, you may get an error in the browser. so firstly you should check the error logs:

steps

tail -f /var/log/nginx/error.log

2016/04/24 18:30:56 [crit] 9879#0: *1 connect() to 192.186.1.6:8081 failed (13: Permission denied) while connecting to upstream, client: 192.186.1.33, server: default, request: “GET / HTTP/1.1”, upstream: “http://192.186.1.6:8081/”, host: “192.186.1.6”

also check :
/var/log/audit/audit.log

may be the issue will be due to SELinux.

so check for errors in the SELinux logs:

sudo cat /var/log/audit/audit.log | grep nginx | grep denied

Running the following commands fixed my issue:

sudo cat /var/log/audit/audit.log | grep nginx | grep denied | audit2allow -M mynginx
sudo semodule -i mynginx.pp

References:

http://blog.frag-gustav.de/2013/07/21/nginx-selinux-me-mad/ https://wiki.gentoo.org/wiki/SELinux/Tutorials/Where_to_find_SELinux_permission_denial_details http://wiki.gentoo.org/wiki/SELinux/Tutorials/Managing_network_port_labels http://www.linuxproblems.org/wiki/Selinux

Related Posts

Written By:

Blog for everything about hosting, website, server and technical support

Add a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.