How to Solve Nginx Error 13: Permission denied) while connecting to upstream

When using nginx for load balancing, there is a problem

1 connect() to 10.51.2.237:8084 failed (13: Permission denied) while connecting to upstream, client: 10.51.2.237, server:

It has been confirmed that the local firewall has been shut down. After some inquiry, it is because of SELinux

SELinux is a mandatory access control (MAC) system provided in Linux kernel version 2.6. It’s a built-in security system, and firewalls should be external

So: there are two solutions

1. Close SELinux

1. Temporary shutdown (no need to restart the machine)

Setenforce 0 # set SELinux to permission mode

##Setenforce 1 sets SELinux to enforcing mode

2. To modify the configuration file, restart the machine

Modify/etc/SELinux/config file

Change SELinux = enforcing to SELinux = disabled

Just restart the machine

2. Execute the following command

setsebool -P httpd_ can_ network_ connect 1

Similar Posts: