Nodejs Nginx error: (13: Permission denied) while connecting to upstream

By default SELinux only allows the web server to make outbound connections to a limited set of ports.

# semanage port --list
http_port_t                    tcp      80, 81, 443, 488, 8008, 8009, 8443, 9000

To fix the problem, you simply need to add your own desired port number to the list.

# semanage port --add --type http_port_t --proto tcp 7777

Then you will see the port number added into the list, and your connections should then work.

# semanage port --list
http_port_t                    tcp      7777, 80, 81, 443, 488, 8008, 8009, 8443, 9000