Solve Nginx's connect() to 127.0.0.1:8080 failed (13: Permission denied) while connect

We encountered this permission problem when performing Nginx+Tomcat load balancing. In the error.log log, we can see the following:

connect() to 127.0.0.1:8080 failed (13: Permission denied) while connecting to upstream,

after After some inspection and google, it should be caused by SeLinux. You can choose some two ways:

1. Turn off SeLinux:

   check the SELinux status:

    1. /usr/sbin/sestatus -v ##If the SELinux status parameter is enabled, it means the enabled status

       SELinux status: enabled

    2. getenforce ##Also possible Use this command to check and

       close SELinux:

       1. Temporarily shut down (without restarting the machine):

       setenforce 0 ##Set SELinux to become permissive mode

       ##setenforce 1 Set SELinux to become enforcing mode

    2. To modify the configuration file, you need to restart the machine:

       modify /etc/selinux/ config file

       to change SELINUX=enforcing to SELINUX=disabled

       Restart the machine to

popularize SELinux:
what is SELinux (Security-Enhanced Linux) is the implementation of mandatory access control by the US National Security Agency (NAS). Under the restrictions of this access control system, a process can only access those in his Documents required in the task. Most people who use SELinux are using an SELinux-ready distribution, such as Fedora, Red Hat Enterprise Linux (RHEL), Debian, or Gentoo. They all enable SELinux in the kernel and provide a customizable security policy, as well as many user-level libraries and tools, all of which can use SELinux functionality.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326169486&siteId=291194637